Color frames in CAP_PVAPI.CPP (Bug #3946)


Added by Shai Vaingast over 10 years ago. Updated almost 10 years ago.


Status:Done Start date:2014-10-09
Priority:Normal Due date:
Assignee:Shai Vaingast % Done:

100%

Category:highgui-camera
Target version:3.0 Estimated time:1.00 hour
Affected version:2.4.9 (latest release) Operating System:Any
Difficulty:Easy HW Platform:Any
Pull request:https://github.com/Itseez/opencv/pull/3322

Description

This is a bug that is present in versions 2.4.9 (and I assume before) as well as 3.0.
In member function IplImage* CvCaptureCAM_PvAPI::retrieveFrame(int), if the variable monocrome is false, the frame is generated by merging three gray channels as follows:

        if (!monocrome)
        {
            cvMerge(grayframe,grayframe,grayframe,NULL,frame);
            return frame;
        }

This is wrong, since if the variable monocrome is false, the image is color (Bgr24) hence the call to cvMerge() above is incorrect.
The fix is to remove the call to the function cvMerge(), as follows:
        if (!monocrome)
        {
            return frame;
        }


I assume that the reason for this bug was that the developer who worked on the code only had a monochrome camera; this was his way of testing the library but the source line remained. In any case, it's wrong and should be fixed in cap_pvapi.cpp across all OpenCV versions.

Note: Cap_Pvapi.cpp was part of highui in OpenCV version 2.4.9 but is part of videoio in OpenCV version 3.0.


Associated revisions

Revision da229cce
Added by Vadim Pisarevsky almost 10 years ago

Merge pull request #3946 from zjulujia:bugfix_for_hog_detectMultiScale_with_weights

History

Updated by Steven Puttemans over 10 years ago

Thanks for the input! Are you up in supplying a pull request yourself with the fix?
If not let me know and I will include it!

  • Assignee set to Shai Vaingast
  • Status changed from New to Open

Updated by Steven Puttemans over 10 years ago

PR submitted!

  • Pull request set to https://github.com/Itseez/opencv/pull/3322

Updated by Philip L almost 10 years ago

PR was merged and solution should also be already in OpenCV 3.0

  • Status changed from Open to Done
  • % Done changed from 0 to 100

Also available in: Atom PDF