Best How To :

x, y image point only determines a ray from the camera centers through the image point. It has infinite number of possible z and when you multiply images point with inverse matrices you will get an equation of a ray or a line. It is impossible to get 3D from a single image point using a single camera. Unless of course you make some strong assumptions such as object shape or size or use extra knowledge such as monocular cues. Examples of such cues are blur/focus, brightness/shading, texture size, familiar size of other objects nearby, etc.

Another example - if you know an equation of the plane where the object lies you can intersect this plane with the ray and arrive at a unique 3D point. Still another example, say, you use an accelerometer in a cell phone which gives you an angle where camera looks relative to the gravity vector. You also know the approximate height at which you hold a cell phone (1.5m above the ground). Than you can easily calculates 3D points on the ground as intersection of your rays with known plane, see below. The formula gives Z for the point in the center of the image. For other points you have to add extra angle formed by off-center pixels. This will allow you to completely restore 3D of the ground plane.

Few things: use sendall instead of send since you're not guaranteed everything will be sent in one go pickle is ok for data serialization but you have to make a protocol of you own for the messages you exchange between the client and the server, this way you can know...

Google sources these Captcha images from Street View imagery. Direct quote from Google spokesperson: We’re currently running an experiment in which characters from Street View images are appearing in CAPTCHAs. We often extract data such as street names and traffic signs from Street View imagery to improve Google Maps with...

The camera calibration process estimates the intrinsic camera parameters: the camera matrix, usually denoted K, and the lens distortion coefficients, D. (NB: the rotation translation matrices of the camera with respect to the pattern are also computed for each image used for the calibration, see "Extrinsic_Parameters", but they are generally...

just do the obvious thing, and specify your c, c++ compiler and the make tool in question: cmake -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM="D:/Programme/MinGW/bin/mingw32-make.exe" -DCMAKE_CXX_COMPILER="D:/Programme/MinGW/bin/mingw32-g++.exe" -DCMAKE_C_COMPILER="D:/Programme/MinGW/bin/mingw32-gcc.exe" -DWITH_IPP=OFF .. (ofc. your path will vary, but i hope, you get the idea) ((if you read between the lines - the opencv devs seem to...

The code is working - the problem is it's sending extra information. The file is there, it is found, it is being sent. The link to your image returns: HTTP/1.1 200 OK Date: Wed, 17 Jun 2015 22:52:03 GMT Server: Apache Connection: close Content-Type: image/jpeg But the subsequent output is...

Plenty of solutions are possible. A geometric approach would detect that the one moving blob is too big to be a single passenger car. Still, this may indicate a car with a caravan. That leads us to another question: if you have two blobs moving close together, how do you...

Not sure what's wrong with the original C-like code, but I'm managed to get it working with C++ like code: using OpenCvSharp; using OpenCvSharp.CPlusPlus; // ... var image = new Mat("Image.png"); var template = new Mat("Template.png"); double minVal, maxVal; Point minLoc, maxLoc; var result = image.MatchTemplate(template, MatchTemplateMethod.CCoeffNormed); result.MinMaxLoc(out minVal, out...

You should always do things that improve the readability and understandability of your code when first learning a language. (And, in many cases, well beyond that point.) Readability of code should be your number one priority at this point. That being said, functions do not really cost any more time...

You can use cv2.resize . Documentation here: http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#resize In your case, assuming the input image im is a numpy array: maxsize = (1024,1024) imRes = cv2.resize(im,maxsize,interpolation=cv2.CV_INTER_AREA) There are different types of interpolation available (INTER_CUBIC, INTER_NEAREST, INTER_AREA,...) but according to the documentation if you need to shrink the image, you should...

What I think is to Save Mat using FileStorage class using JNI. The following code can be used to save Mat as File Storage FileStorage storage("image.xml", FileStorage::WRITE); storage << "img" << mat; storage.release(); Then send the file using Socket and then retrive Mat back from File. FileStorage fs("image.xml", FileStorage::READ); Mat...

You can get each point of the raster line using cv::LineIterator class, e.g.: // grabs pixels along the line (pt1, pt2) // from 8-bit 3-channel image to the buffer LineIterator it(img, pt1, pt2, 8); LineIterator it2 = it; vector<Vec3b> buf(it.count); for(int i = 0; i < it.count; i++, ++it) buf[i]...

Before you write it out with ImageIO, create a BufferedImage first. It can be as simple as using the setRGB methods, and has the added benefit of allowing you to observe the image before writing it out.

You need to know the camera's intrinsic parameters, so that you can also know the distance between pixels in the same units (mm). This distance between pixels is obviously true for a certain distance from the camera (i.e. the value of the center pixel) If the camera matrix is K...

Answers in order: 1) "r" is the pixel's radius with respect to the distortion center. That is: r = sqrt((x - x_c)^2 + (y - y_c)^2) where (x_c, y_c) is the center of the nonlinear distortion (i.e. the point in the image that has zero nonlinear distortion. This is usually...

your code works for me. But you used cv::waitKey(0) which means that the program waits there until you press a keyboard key. So try pressing a key after drawing, or use cv::waitKey(30) instead. If this doesnt help you, please add some std::cout in your callback function to verify it is...

It's very simple. I actually wouldn't use the code above and use the image processing toolbox instead. There's a built-in function to remove any white pixels that touch the border of the image. Use the imclearborder function. The function will return a new binary image where any pixels that were...

From the Matlab forums, the dir command output sorting is not specified, but it seems to be purely alphabetical order (with purely I mean that it does not take into account sorter filenames first). Therefore, you would have to manually sort the names. The following code is taken from this...

Remove all references to the library. Somewhere that project is pointing at the path you give above and you need to remove that. Then add the library into the executable project. Right click->add->existing item, change the type to all files, then browse to the file location. ...

The problem you are experiencing comes from saving the data to a MATLAB data file, renaming the file with a .jpg extension and trying to use imread to read in the data. This unfortunately doesn't work. You can't change the file type of your data from .mat to .jpg. All...

As per the documentation, the cv2.adaptiveThreshold() returns only 1 value that is the threshold image and in this case you are trying to receive 2 values from that method, that is why ValueError: too many values to unpack error is raised. After fixing the issue the code may look like:...

You can use the bitdepth parameter to set that. imwrite(img,'myimg.png','bitdepth',16) Of course, not all image formats support all bitdepths, so make sure you are choosing the the right format for your data....

Use cv2.fillConvexPoly so that you can specify a 2D array of points and define a mask which fills in the shape that is defined by these points to be white in the mask. Some fair warning should be made where the points that are defined in your polygon are convex...

This is not the right way to test for type conversion. OpenCV's data variable in cv::Mat is always of type uchar. It is basically a pointer to memory, but it doesn't mean that the data is uchar. To get the type of the image data use the type() function. Here...

I think you can locate the shape pretty accurately with a simple threshold, like this: convert image.jpg -threshold 90% result.jpg and you can then do a Canny edge detection like this: convert image.jpg -threshold 90% -canny 0x1+10%+30% result.jpg The next things I would be looking at are, using the -trim...

As I suspected, it's the Coded! I used many of them, but then I found this question: Create Video from images using VideoCapture (OpenCV) then I used the coded MJPG in: outputVideo.open(name, CV_FOURCC('M', 'J', 'P', 'G'), 25, size, true); // create a new videoFile with 25fps and it worked! Here's...

You're using a Ptr<DescriptorMatcher> so you should dereference it in order to call the method... matcher.knnMatch(descriptorsLeft, descriptorsRight,3); //error matcher->knnMatch(descriptorsLeft, descriptorsRight,3); // should be better ...

OpenCV is a framework written in C++. Apple's reference tell us that You cannot import C++ code directly into Swift. Instead, create an Objective-C or C wrapper for C++ code. so you cannot directly import and use OpenCV in a swift project, but this is actually not bad at all...

You have not linked the executable against several libraries that are required by the program Try using this: g++ -lpthread `pkg-config opencv --libs` -I/usr/local/include/ -lraspicam -lraspicam_cv -L/opt/vc/lib -lmmal -lmmal_core -lmmal_util -I/usr/include -lwiringPi test3.cpp -o test3 ...

If you simply want to ignore the columns/rows that lie outside full sub-blocks, you just subtract the width/height of the sub-block from the corresponding loop ranges: overlap = 4 blockWidth = 8; blockHeight = 8; count = 1; for i = 1:overlap:size(img,1) - blockHeight + 1 for j = 1:overlap:size(img,2)...