2018-12-04 13:52:55 -0600 | received badge | ● Notable Question (source) |
2018-02-19 00:12:46 -0600 | received badge | ● Popular Question (source) |
2015-04-14 08:19:08 -0600 | commented answer | Getting error Assertion failed. Sorry for the long absence, busy weekend. Anyway, for testing you could just add a raw delay at the top of your loop...something like waitkey(1000); Play with the number and see if there is a threshold which works, it would be cool to know just how fast the camera refreshes. A better answer would be to check the size of the returned image and just try again when image.empty (or image.rows == 0 && image.cols == 0 ) is true. Good luck! |
2015-04-08 22:41:59 -0600 | received badge | ● Self-Learner (source) |
2015-04-08 15:50:30 -0600 | answered a question | Getting error Assertion failed. OK, I zoomed in on your screen grab enough to read the actual error message...it is saying that when imshow ran, it had an input that was size 0x0. My best guess is that the camera is slower than your code and sometimes the capture fails, producing an empty image. I would put in a test for empty, just like when you use imread on a file. |
2015-04-08 15:19:03 -0600 | asked a question | Mat .rows .cols swapped? OK, I've got to be going crazy here. I ran one of the tutorials for affine transformations (I am actually starting to care about image coordinates). I am using an image that I KNOW is 980 rows x 586 columns (checked it in paint). then I get this in the watch window: source.rows and source.cols are swapped, what is going on? |
2015-04-08 12:33:12 -0600 | commented question | Getting error Assertion failed. Your roi is a single row... is that what you intend? Just a guess, but that single dimensionality may confuse the following imshow. |
2015-04-08 10:58:26 -0600 | answered a question | perspectiveTransform on contours? I ended up scanning the contours point by point and multiplying each by the rotation matrix. Maybe there is some sort of typecast that operates on a vector and would have let me use perspectiveTransform, but I've no clue what it may be. |
2015-04-07 11:30:37 -0600 | asked a question | perspectiveTransform on contours? Hi all, I've got a contour for a flat, irregular shape with ~ten, 2D, points. I'd like to project just that contour, not the whole image, into a normal view and then find area, etc. I know the contour is OK because drawContours has the expected result. The rotation matrix, Rot3D, works with warpPerspective on the full image (I play with the rotations for the background in a calibration step, then try to use the same rotation matrix here. It is a (3, 3, CV_32FC1) ). I simplified everything to this code: ` ` which fails an assertion check: No clue what that means...contours1 is a vector<vector<point>> ... Douh! could that be it... OK, findContours produces <point> (i.e., two int), perspectiveTransform requires <point2f> |
2015-03-31 16:01:01 -0600 | commented answer | How Do I Calculates The Angle Of Orientation Of The Image With The Fourier Transform? OK, pulled out phasePart, but it is still just snow (see above). I am thinking of doing a polar histogram on just magnitude of one quadrant, the biggest pile will be in the direction I care about (maybe). |
2015-03-31 02:42:35 -0600 | received badge | ● Teacher (source) |
2015-03-30 12:52:04 -0600 | commented answer | How Do I Calculates The Angle Of Orientation Of The Image With The Fourier Transform? So now the OP has a DFT that works (as I do), how do you find the angle from the result? |
2015-03-30 12:47:29 -0600 | answered a question | OpenCV Error: Assertion failed (size and height = 0) in imshow following adaptiveThreshold. @matman, Thanks for the attention to this. EDIT - problem was, I redefined "src" in main so the global variable used in other functions was still blank (hangs head in newbie shame). I'm deleting the rest of this... Thanks. |
2015-03-30 12:46:30 -0600 | commented question | OpenCV Error: Assertion failed (size and height = 0) in imshow following adaptiveThreshold. Trying to post code...too long for comment window. |
2015-03-28 05:38:13 -0600 | received badge | ● Necromancer (source) |
2015-03-26 15:09:02 -0600 | asked a question | calibrate angle from dft The DFT tutorial ends with
Tantalizing. How? My result: has features at about 45 and 135 degrees as expected so the DFT part worked. Is there something I can extract directly from the complex values of the DFT result? |
2015-03-26 13:56:18 -0600 | commented question | Calculates the angle of orientation of the image with the fourier transform And close the duplicate question. |
2015-03-26 13:54:20 -0600 | answered a question | How Do I Calculates The Angle Of Orientation Of The Image With The Fourier Transform? Well, the Assertion is saying that the number of channels is wrong. Best guess is that you still have color when you need to go either grey (or extract one of the BGR components). I thought the imread should have handled that but the flag to convert to grey is not explicit. Try src = imread("Filename", 0); //0 for grey, 1 for color. The step you reference (line numbers please!) is where the complex dimension gets added to the image data. It looks like you copied the tutorial verbatim. Is padded bigger than I at this point as it should be? Otherwise, I'm just trying to read through the tutorial. It looks like you copied that anyway, why not run that with your image? Then let me know how you get the angle! EDIT I think the spirit of the original question was how to interpret results like these: EDIT Pulling out phase as suggested. Similar quadrant swap but not log scale of course. |
2015-03-26 09:39:50 -0600 | commented question | OpenCV Error: Assertion failed (size and height = 0) in imshow following adaptiveThreshold. OK, I'm working on a cleaned up version to isolate the problem. When I said 1/3 of the image I meant the top 1/3 with the remaining pixels being unchanged. And that number was approximate anyway. I was trying to set this up so I could use a trackbar to set the threshold. I just copied a tutorial example and dropped in a different function. The examples use global variables liberally (bad form but hey, it is a tutorial). In this case, inside the function the data Mat was blank. That makes sense with the assert that threw the error but I don't know how the global variable didn't work. This has moved far away from where I started - what is good form here for this question? Retag it? Close it and ask again better? |
2015-03-25 20:54:14 -0600 | received badge | ● Necromancer (source) |
2015-03-25 15:38:33 -0600 | answered a question | custom grayscale conversion For only a single channel, you could use this: I'm grabbing the green only from a white-hot object, which has the best contrast. Dimmer things will need some other tricks though...let me know how it goes! |
2015-03-25 15:30:41 -0600 | received badge | ● Supporter (source) |
2015-03-25 07:17:31 -0600 | commented question | OpenCV Error: Assertion failed (size and height = 0) in imshow following adaptiveThreshold. No, neither mode works. Release mode, invoked from the command line, fails with a windows 'program has stopped working' popup and the quoted text on the command line, '... line 266.' Debug mode pops up the 'unhandled exception' window, indicates the imshow is the next to execute, and opens a second console window. This second window today matches the release mode one, blaming an assert in window.cpp line 266, yesterday was different (screenshot above). I rebooted the PC and cleaned the project prior to this, no other changes. I just checked, I'm definitely using the 'd' version libraries in debug mode. Off to try a demo straight from the documentation... |
2015-03-24 16:03:25 -0600 | asked a question | OpenCV Error: Assertion failed (size and height = 0) in imshow following adaptiveThreshold. This is a weird one.
gives 'unhandled exception' in debug mode, with the second line being indicated as the next to execute after the break. In release mode, the command line shows:
with the same input file. src_grn is an image of CV_8UC1 type (green channel extracted from an RGB image with mixChannels earlier). Mat scratch is declared earlier but not initialized to any particular size or type. If I continue instead of breaking after the exception it looks like the top 1/3 of the image gets filtered. Commenting out the imshow prevents the error (not that that is helpful). Putting the imshow back in and setting the window to autosize spits out: (sorry for the screen grab, it won't let me copy the text) something about 'Bad flag' in core\src\array.cpp, line 2489. Commenting the adaptiveThreshold line gives my source image back again, displayed normally. This is OpenCV3.0 under VS13 express. Ideas? |
2015-03-16 14:24:41 -0600 | received badge | ● Editor (source) |
2015-03-06 10:58:19 -0600 | received badge | ● Student (source) |
2015-03-06 08:23:48 -0600 | asked a question | OpenCV3.0 migration guide? Hi all, I installed CV2, got some demos working, then decided to try CV3 when I found an interesting one that depended on it. CV3 installed and the new demo works but now (HA!) the old ones are broke. I gather there are significant changes in the API and a lot of legacy support is gone. Does anyone have a list of what is gone and what replaces it? Other things I should know for a successful migration? In case there is no better answer, I know O'Reilly has a second edition of their OpenCV book for 3.0 coming out end of April. Hopefully that will highlight changes but I don't want to wait. For what it matters, I'm working in C++ under VS13. Thanks Update: an example of the gotchas I've found. imwrite, according to this 3.0.0 API ref, supports a number of parameters including CV_IMWRITE_JPEG_QUALITY. The 'CV_' prefix kills it...apparently points back to an obsolete C header, imgcodecs_c.h. Point is, removing 'CV_' is proper (works anyway) for CV3. The example code farther down has the same problem. What makes it hard to find is that the enumeration exists, just isn't #INCLUDEed ... because it shouldn't be. It would be better if the deprecated header didn't exist. I installed from the .zip file so I don't think I grabbed stuff I shouldn't have. I did check the references in the answers (thanks again), but didn't see/understand if there a list of these kinds of things, should there be? |
2015-03-04 16:17:31 -0600 | answered a question | install openCV 3.0 beta on windows 7 Big fight with this today. Instructions for VS13 install work for CV2 but are misleading for CV3. Bottom line, you need to tell the linker about the contents of $(OPENCV_DIR)\lib, which are only opencv_ts300d.lib;opencv_world300d.lib, not the long list it was before. |
2015-03-04 10:59:44 -0600 | received badge | ● Enthusiast |
2015-02-25 16:13:28 -0600 | answered a question | Camera as angle encoder I've been working on something similar. For a target, I started with a surveyor's benchmark (2x2 checkerboard) but now think a 1x1 colored square centered in a 3x3 white one would work better. What type of camera/sensor are you using? |
2015-02-25 16:00:12 -0600 | asked a question | Memory allocation in Mat for images - does it change type? Hi all, I think I have this figured out but I'm interested in your perspective. I'm working in C++ under VS2013. From the documentation on rotated rectangles there is this declaration: That looks like 200 x 200 pixels, 8-bit BRG color, with three color values passed in by the Scalar (Scalar being anything other than a simple number is a confusing offense unto Nuggin but is discussed elsewhere). I wanted to check if the type casting really worked, storing 24 bits per pixel, or if the Scalar was still reserving four doubles for each. Finding (int)abs(image.datastart - image.dataend) resulted in 3 unsigned char per pixel ... which Microsoft says is a 1 byte type (MS VBA is 2 bytes for a char, go figure). So that all looks as expected, minimum space used and all is well. Problem though, I think I read as I researched this that under some matrix arithmetic operations the data gets changed to type float. I guess I could see the utility in that but it seems like a gotcha too. Does that really happen? What is good practice here? Thanks |