Ask Your Question

jp2112's profile - activity

2020-12-13 05:05:45 -0500 received badge  Notable Question (source)
2020-09-23 04:29:25 -0500 received badge  Popular Question (source)
2020-05-20 16:36:15 -0500 edited question why is imshow window 2:1 scaled on one pc, 1:1 scaled on another with idential code?

why is imshow window 2:1 scaled on one pc, 1:1 scaled on another with idential code? I recently updated/rebuilt OpenCV 4

2020-05-20 16:32:02 -0500 asked a question why is imshow window 2:1 scaled on one pc, 1:1 scaled on another with idential code?

why is imshow window 2:1 scaled on one pc, 1:1 scaled on another with idential code? I recently updated/rebuilt OpenCV 4

2020-05-05 08:00:16 -0500 received badge  Popular Question (source)
2019-11-26 10:30:14 -0500 edited question why is type Mat still not resolved in my new eclipse install?

why is type Mat still not resolved in my new eclipse install? I've installed versions of OpenCV a few times in Windows 7

2019-11-26 10:29:55 -0500 edited question why is type Mat still not resolved in my new eclipse install?

why is type Mat still not resolved in my new eclipse install? I've installed versions of OpenCV a few times in Windows 7

2019-11-26 10:22:30 -0500 commented question why is type Mat still not resolved in my new eclipse install?

Hi berak, usually I wouldn't do screenshots but in this case it's the context around the code that I'm trying to show, i

2019-11-25 18:03:01 -0500 edited question why is type Mat still not resolved in my new eclipse install?

why is type Mat still not resolved in my new eclipse install? I've installed versions of OpenCV a few times in Windows 7

2019-11-25 18:02:03 -0500 edited question why is type Mat still not resolved in my new eclipse install?

why is type Mat still not resolved in my new eclipse install? I've installed versions of OpenCV a few times in Windows 7

2019-11-25 17:59:19 -0500 edited question why is type Mat still not resolved in my new eclipse install?

why is type Mat still not resolved in my new eclipse install? I've installed versions of OpenCV a few times in Windows 7

2019-11-25 17:59:11 -0500 edited question why is type Mat still not resolved in my new eclipse install?

why is type Mat still not resolved in my new eclipse install? I've installed versions of OpenCV a few times in Windows 7

2019-11-25 17:56:20 -0500 asked a question why is type Mat still not resolved in my new eclipse install?

why is type Mat still not resolved in my new eclipse install? I've installed versions of OpenCV a few times in Windows 7

2019-05-31 16:04:40 -0500 asked a question why do I get "random" window size with resizeWindow()?

why do I get "random" window size with resizeWindow()? I'm using Ubuntu 18.04 with Eclipse C++/CUDA toolchain. I built

2019-05-17 12:21:49 -0500 received badge  Enthusiast
2019-05-16 15:03:40 -0500 received badge  Editor (source)
2019-05-16 15:03:40 -0500 edited question How do I fix “undefined reference to `cv::cuda::…” linker errors in Eclipse?

How do I fix “undefined reference to `cv::cuda::…” linker errors in Eclipse? Disclaimer: I'm new to this whole Linux and

2019-05-16 15:02:38 -0500 asked a question How do I fix “undefined reference to `cv::cuda::…” linker errors in Eclipse?

How do I fix “undefined reference to `cv::cuda::…” linker errors in Eclipse? Disclaimer: I'm new to this whole Linux and

2017-02-14 18:39:25 -0500 commented answer how to return array of minimum values between two arrays

ok. Just a note that (min) also works. And I see that the include file <windows.h>, which I am using in order to get my display size, is where min(a,b) and max(a,b) are defined as macros, so this is why I am having this problem. I found this link:

[http://stackoverflow.com/questions/1632145/use-of-min-and-max-functions-in-c (http://stackoverflow.com/questions/16...)]

2017-02-13 23:43:21 -0500 commented answer how to return array of minimum values between two arrays

The (cv::min) solution worked. The #define may have also worked but elsewhere in my code I was using the standard C overloads for max() and min(), so those lines were now getting flagged.

Perhaps this is a bug in OpenCV, that it doesn't recognize array operators max() or min() unless specified as was done here? Or maybe it's because I'm using VSE?

Many thanks!

2017-02-13 20:31:43 -0500 commented answer how to return array of minimum values between two arrays

yea, I tried both of those ways but it still doesn't like the min part.

    Mat norm(data.size(), CV_32F);
   (norm gets computed here)
      float minnormval = some_threshold;
      Mat result;
      result = cv::min(norm, minnormval); // doesn't work
      cv::min(norm, minnormval, result); // doesn't work

When I hover over the "min" word I get the message

#define min(a,b) (((a) < (b)) ? (a) : (b))
expected an identifier
2017-02-13 17:09:19 -0500 asked a question how to return array of minimum values between two arrays

According to the help docs, there is a function min() that says it computes an output array that is the per element minimum of two input arrays or array and scalar, but when I use this in my code it's not recognized as valid OpenCV (no overload given). What is the function to do this minimum? I'm using 3.2.0 in Win7 on VSE2015 C/C++. Thanks.

2017-02-03 23:17:21 -0500 commented question why are mat operators seeing wrong type?

Got it. I was finally able to get this to work by doing as you said, combined with simplifying my Mat declarations. Might have avoided this whole confusion if OpenCV used some other symbol for matrix multiply ("#" would make sense to me!) Anyhow, you both lead me to the solution so thanks for the numerous replies.

2017-02-03 19:35:02 -0500 commented question why are mat operators seeing wrong type?

By adding the following line right above the crash line I was able to see that invgain_map was being set to array type 0 despite being declared as type 5:

  cerr << ffused_image.type() << " " << invgain_map.type() << endl; // outputs 5 0 with orig code

But now riddle me this: when I add this line just above the cerr line to convert invgain_map back to type 5:

  invgain_map.convertTo(invgain_map, CV_32F);

it still crashes on the following multiply line even though the cerr output now shows 5 5, so I know types are the same. So what gives? Plus I am now getting this error:

OpenCV Error: Assertion failed (a_size.width == len) in cv::gemm, file C:\build\master_winpack-build-win64-vc14\opencv\m
odules\core\src\matmul.cpp, line 1537

How can the lengths be different?

2017-02-03 16:21:23 -0500 commented answer why is createButton not implemented?

I guess as a non-developer I don't understand why the trackbars and buttons require different libraries. Seems reasonable that if you use one you'd usually want the other, and while trackbars could be used as binary selectors they take up WAY too much window area (By the way why is this? I see so much wasted space below the bottom trackbar that 2-3 more could easily fit there.) What's so special about buttons anyway that they need their own library? So are trackbars the only gui option for default builds of OpenCV?

2017-02-03 12:37:32 -0500 commented question why are mat operators seeing wrong type?

Even if map array is CV_16S because the blur function output it that way, why wouldn't the gain_map = map / 255.0 assignment keep gain_map as CV_32F? I don't use map again in the code, only gain_map.

So what I hear you saying is that, unlike just about every other language I've seen, in OpenCV a Matrix can actually CHANGE it's own type on the fly even when it's declared to be a specific type? If true then that's crazy!

I tried adding this line:

map.convertTo(map, CV_32F);

prior to dividing by 255.0 and assigning to gain_map, but it doesn't help.

2017-02-03 12:23:09 -0500 commented question why are mat operators seeing wrong type?

I left out the blur intentionally because it's not relevant to the problem. but here's the line

blur(regions, map, Size(5, 5));

where regions and map are declared simply as Mat types earlier, so they get converted to whatever is necessary by their compare and blur functions, respectively. so gain_map = map / 255.0 and should still be CV_32F type at this point, no?

my first attempts at this code actually wasn't trying to set output/result Mat's to something, so here I am now trying to make it happy by forcing everything to be CV_32F. but it's not happy.

2017-02-03 12:00:30 -0500 commented question why are mat operators seeing wrong type?

will do next time. by the way I'm using 3.2.0 on windows 7

2017-02-03 11:34:55 -0500 asked a question why are mat operators seeing wrong type?

I'm at a loss here, why does my code crash with the error:

OpenCV Error: Assertion failed (type == B.type() && (type == CV_32FC1 || type == CV_64FC1 || type == CV_32FC2 || type == CV_64FC2)) in cv::gemm, file C:\build\master_winpack-build-win64-vc14\opencv\modules\core\src\matmul.cpp, line 1530

Below is basically what I'm trying to do, some lines may be unnecessary but I've been removing all assumptions about auto-allocation and matrix depths. Note, live_image comes into my function as "const Mat" with depth CV_16U.

   ...
  static Mat fused_image(live_image.rows, live_image.cols, live_image.type()); // this is my return Mat so same type
  Mat gain_map(live_image.rows, live_image.cols, CV_32F); // gain_map gets the result of a blur() divided by 255.0
   ...
   if (frame == 1) {
    live_image.copyTo(fused_image); // initialize on first pass thru function, they have same type
  }
  // else fused_image is generated by the remaining function code and retained for the next frame iteration    
...

  Mat flive_image(live_image.rows, live_image.cols, CV_32F); // declare my fp arrays

  Mat ffused_image(live_image.rows, live_image.cols, CV_32F);
  Mat fffused_image(live_image.rows, live_image.cols, CV_32F);
  Mat invgain_map(live_image.rows, live_image.cols, CV_32F);
  live_image.convertTo(flive_image, CV_32F);                               // should flive_image = live_image be equivalent?
  fused_image.convertTo(ffused_image, CV_32F);                         // ditto, should now have fp versions of ushort arrays

  invgain_map = -1.0 * gain_map + 1.0;                                         // also tried "1.0 - gain_map;" as well as "gain_map.convertTo(invgain_map, -1, -1, 1);"
  fffused_image = ffused_image * invgain_map;                            // crashes on this line, also tried C=A.mul(B) and multiply(A, B, C)
 ...
// note, fused_image would eventually be converted back to CV_16U from fffused_image after more matrix processing.

...

As noted it crashes on the last multiply line. When I replace * with multiply() I get a different but related error:

OpenCV Error: Bad argument (When the input arrays in add/subtract/multiply/divide functions have different types, the output array type must be explicitly specified) in cv::arithm_op, file C:\build\master_winpack-build-win64-vc14\opencv\modules\core\src\arithm.cpp, line 683

But how in the world can my types be different? I left nothing to chance. Thanks for any help.

2017-02-03 10:38:04 -0500 commented answer why is createButton not implemented?

thanks for reply. ok, but what's the harm with the developers compiling OpenCV with the QT libs? else disabled features like createbutton should have a disclaimer in the docs so novice people don't waste time crashing.

2017-01-28 18:47:50 -0500 asked a question why is createButton not implemented?

I am using precompiled release 3.2.0 within VSE 2015 and would like to add a button to my window, since I am getting good use out of the trackbars. But when I run my exe it crashes and I get this message written to the console:

OpenCV Error: The function/feature is not implemented (The library is compiled without QT support) in cv::createButton, file C:\build\master_winpack-build-win64-vc14\opencv\modules\highgui\src\window.cpp, line 526

Does this mean there is no way for a button to work? Is there a plan to offer a version of OpenCV with the button features working? If not, why? I'm not a hard core programmer so I don't know the process of compiling my own OpenCV installation and I don't have time to deal with that anyhow. Thanks.

2017-01-23 22:24:45 -0500 commented answer how to make a composite mask?

That makes it simple, thanks for pointing it out. I couldn't find any description of this in the documentation.

2017-01-23 19:10:11 -0500 commented answer how to make a composite mask?

Anyhow, it would seem trivial for OpenCV to add two mask-level functions that treat mask elements pixelwise. Nice and clean.

i.e. for each array pixel, mask_or() would be zero, zero = 0 zero, nonzero = 255 nonzero, nonzero = 255

mask_and() would be zero, zero = 0 zero, nonzero = 0 nonzero, nonzero = 255

2017-01-23 18:59:13 -0500 commented answer how to make a composite mask?

what is maskX?

2017-01-23 16:53:31 -0500 commented answer how to make a composite mask?

I can't guarantee that the values are all the same, just that they are zero or nonzero. One mask might have 0 and 255 values but another may have 0 and 8bit grayscale values and another may have 0 and 1 values.

Am I correct in saying that if you were to bitwise_and a mask of all 128s with a mask of all 1s you would get a mask of all 0s, but pixelwise should return a mask of all 255 which is what I want since both masks contain all nonzero (i.e. true) pixels.

Sounds like there is no convenient command for this desired action.

2017-01-23 16:09:34 -0500 asked a question how to make a composite mask?

I have several masks that I created using the compare() function. They are all CV_8U type. Now I want to make a composite mask in one step, if possible, using all of these submasks. I know how to make a logical OR'd mask using

final_mask = mask1 + mask2 + mask3...

but I want a logical AND'd mask. Doing this:

final_mask = mask1 * mask2 * mask3...

hangs up my application, likely because the result blows up too large for the saturate_cast<> operation. How do I do this? I see there's a bitwise_and() but I want pixelwise. Thanks.

2017-01-16 17:02:17 -0500 commented answer how is b=a.clone() different than a.copyTo(b)? which is faster?

Thanks for this code to run. It gives me practically identical results for clone and copyTo. So am I correct to understand that clone is actually just a copyTo operation nested within a function call? Why would this be necessary? Anyhow, I have my answer in that I will just use copyTo.

2017-01-16 00:36:01 -0500 asked a question how is b=a.clone() different than a.copyTo(b)? which is faster?

For an image processing demo I need to squeeze every bit of optimization out of my code to get a higher frame rate, but I'm familiar with hardware programming (VHDL) and not so much with CPU programming languages. So it's not clear to me how much faster code can run by moving statements such as variable declarations outside of loops and functions, i.e., does encountering a type declaration millions of times actually slow down execution? To this end, there also seem to be different methods to performing the same OpenCV array tasks on Mat types. My big question at this time is whether I should use clone or copyTo if I simply want to make a copy of an existing Mat array. Does it matter if the dst array has already been declared with the same size as the src? Thanks.

2016-12-25 00:05:20 -0500 asked a question what is difference between versions 2.4.13 and 3.2?

I am a complete newbie to opencv and I want to install it to use in visual studio express 2015. looks like two different versions are being maintained on the web site but no explanation, which should I install for win7pro 64-bit? I don't want to compile my own libraries, simpler is better. thanks.