sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: opencv
Issue: Conversion RGB2HSI
Labels: auto-transferred,priority: normal,feature,category: imgproc,category: video

Transferred from http://code.opencv.org/issues/2950

```
|| Rel Guzman Apaza on 2013-04-10 00:16
|| Priority: Normal
|| Affected: None
|| Category: imgproc, video
|| Tracker: Feature
|| Difficulty: None
|| PR: 
|| Platform: None / None
```
## Conversion RGB2HSI

```
There is no CV_RGB2HSI conversion in the github repository
I need the function to implement something like this one

http://www.sciencedirect.com/science/article/pii/S1077314206002141

I can do the changes in the repository .')
```
## History
##### Maria Dimashova on 2013-04-10 07:18

```
Yes, please do the changes and submit them as a pull request on "OpenCV github":https://github.com/Itseez/opencv/pulls.
-   Priority changed from High to Low
-   Category set to imgproc, video
```
##### Maria Dimashova on 2013-04-10 07:19

```
-   Priority changed from Low to Normal
```
##### Kirill Kornyakov on 2013-04-11 14:31

```
-   Assignee changed from Vadim Pisarevsky to Rel Guzman Apaza
```
##### Gurpinder Sandhu on 2013-04-26 16:40

```
Any updates whether it has been done, I want to use it. If not I myself can make a pull request :)
```
##### Anna Kogan on 2013-05-07 08:40

```
Hello Rel, Gurpinder,
You are welcome to make pull request implementing the functionality. Here's full description of contributing process: http://www.code.opencv.org/projects/opencv/wiki/How_to_contribute
```
Repository: opencv
Issue: videostab: missing documentation
Labels: bug,auto-transferred,priority: low,category: documentation,affected: 2.4

Transferred from http://code.opencv.org/issues/2955

```
|| Tom Deakin on 2013-04-14 14:22
|| Priority: Low
|| Affected: 2.4.5 (latest release)
|| Category: documentation
|| Tracker: Bug
|| Difficulty: None
|| PR: 
|| Platform: None / None
```
## videostab: missing documentation

```
In the current http://docs.opencv.org/ there is no documentation for the videostab module.

Also, the documentation at http://docs.opencv.org/trunk/modules/videostab/doc/videostab.html is incomplete - there is no information about the GaussianMotionFilter (for example) and others used in the videostab.cpp sample file.

As videostab is included in the current 2.4.5 release without documentation, would it be possible to generate the documentation for this?
```
## History
##### Kirill Kornyakov on 2013-04-14 20:54

```
Tom, it would be great if you could work on it yourself and prepare a pull request. Reading code should be simpler than writing =) Original author of this module has left the project, so better to not expect fast response.

Is anybody else from community ready to work on documenting this?
-   Target version set to Next Hackathon
-   Priority changed from High to Low
-   Category changed from videostab to documentation
```
##### Tom Deakin on 2013-04-14 23:23

```
Kirill, Thanks for the update. I will see if I have any time and will update some documentation. Just to clarify, the 2.4 branch is missing some of the updates from master, some of which were written in 2012. Do you know why these changed have not been included in a 2.4.x release yet?

TLDR: which branch is the documentation for?
```
Repository: opencv
Issue: Flann problem with AutotunedIndexParams
Labels: bug,auto-transferred,priority: normal,affected: 2.4,category: flann

Transferred from http://code.opencv.org/issues/2956

```
|| Fisher Yu on 2013-04-14 15:35
|| Priority: Normal
|| Affected: branch '2.4'
|| Category: flann
|| Tracker: Bug
|| Difficulty: None
|| PR: 
|| Platform: None / None
```
## Flann problem with AutotunedIndexParams

```
I use flann with AutotunedIndexParams to match sift descriptors. However, when there were more than 1000 features, I got the error "pointer being freed was not allocated". It did work for several hundred features and I don't know the exact boundary number of features to cause the problem. Attached is a small program to reproduce the problem. I am using 2.4.3 with clang on Mac OS X 10.8
```
## History
##### Vladislav Vinogradov on 2013-06-10 08:19

```
-   Category set to flann
```
Repository: opencv
Issue: Multiple vulnerabilities in OpenCV
Labels: auto-transferred,feature,priority: low,category: core

Transferred from http://code.opencv.org/issues/2968

```
|| Andres Gomez on 2013-04-17 04:02
|| Priority: Low
|| Affected: None
|| Category: core
|| Tracker: Feature
|| Difficulty: 
|| PR: 
|| Platform: None / None
```
## Multiple vulnerabilities in OpenCV

```
Hi,

I worked with OpenCv some time ago and I decided to carry out a little security audit. The tool used was flawfinder with the following command line:

flawfinder -m 3 --html --quiet --dataonly --context opencv-2.4.4/ > opencv-flaws.html

This analyses the source code and returns a lot of results, most of them false positive. But there are already several vulnerabilities I checked as real:

In the file opencv-2.4.4/modules/legacy/src/oneway.cpp line 1795:

            if (fscanf(pFile, "%s", imagename) <= 0)

There is a buffer overflow when reading long files names from a list of files. For example when executing:

./c-example-one_way_sample location scene_l.bmp scene_r.bmp
Reading the images...
Extracted 42 keypoints...
Training one way descriptors...
*** buffer overflow detected ***: ./c-example-one_way_sample terminated

This program reads a file called "one_way_train_images.txt" which its content is:

one_way_train_0000AAAAAAAAAAA...AAAAAAAAAAAAAAAAAAAAAAAAAA.jpg
one_way_train_0001BBBBBBBBBBB...BBBBBBBBBBBBBBBBBBBBBBBBBB.jpg




In the file opencv-2.4.4/modules/highgui/src/cap_images.cpp line 114:

    sprintf(str, filename, firstframe + currentframe);

There is a format string when reading special files names. For example:

./c-example-adaptiveskindetector C:\VideoSequences\sample1\right_view\temp_%05d%n%s%s%s%s%s.jpg  0  1000

Press ESC to stop.

*** %n in writable segment detected ***
Abortado

These bugs can be exploited to execute arbitrary code.


Although of less concern, also there are vulnerabilities in the samples, here are two I found:

opencv-2.4.4/samples/cpp/hybridtrackingsample.cpp line 82, a buffer overflow:

        sprintf(test_file, "%s", argv[1]);


opencv-2.4.4/samples/cpp/hybridtrackingsample.cpp line 85 another buffer overflow:

        int values_read = fscanf(f, "%s\n", vid);

Best regards,

Andres Gomez.
```
## History
##### Vadim Pisarevsky on 2015-04-28 11:49

```
thanks; I do not think we will be able to address any of the vulnerabilities by ourselves, we are not experts in it. We'd let specialists to provide patches that we will be happy to integrate
-   Priority changed from Normal to Low
-   Tracker changed from Bug to Feature
```
Repository: opencv
Issue: SIFT Octave bug
Labels: auto-transferred,priority: normal,feature,category: nonfree

Transferred from http://code.opencv.org/issues/2987

```
|| Andew Sabrew on 2013-04-25 20:36
|| Priority: Normal
|| Affected: None
|| Category: nonfree
|| Tracker: Feature
|| Difficulty: 
|| PR: 
|| Platform: None / None
```
## SIFT Octave bug

```
I think SIFT sets a bad value for octave in the @KeyPoint@ class. If you print the value of keypoint.octave you get something like this:

<pre>
Octave value:10420482
Octave value:10420482
Octave value:11337985
Octave value:10944771
</pre>

And it can't be true because octave ranges are very low.
```
## History
##### Anna Kogan on 2013-05-07 08:48

```
Hello Andrew,
Thank you for reporting the issue. If you investigate the problem further and fix it on your side, a "pull request":http://www.code.opencv.org/projects/opencv/wiki/How_to_contribute in our GitHub repo would be highly appreciated!
```
##### Vladislav Vinogradov on 2013-06-10 10:35

```
SIFT writes a packed value (octave, layer and scale) to octave member. You can unpack this values with following function:

<pre>
void unpackSIFTOctave(const KeyPoint& kpt, int& octave, int& layer, float& scale)
{
    octave = kpt.octave & 255;
    layer = (kpt.octave >> 8) & 255;
    octave = octave < 128 ? octave : (-128 | octave);
    scale = octave >= 0 ? 1.f/(1 << octave) : (float)(1 << -octave);
}
</pre>
-   Status changed from Open to Cancelled
```
##### Guanta Alecho on 2013-06-21 21:30

```
Sorry to start a discussion: But shouldn't this be changed? Hhow should a typical user know that?
-   Status changed from Cancelled to Incomplete
```
##### Kirill Kornyakov on 2013-06-27 08:31

```
Well, we can either document this, or change the behavior. Most likely we shouldn't change the behavior, so the existing code continue to work. Where it could be done? Or you have other suggestions?
-   Description changed from I think SIFT sets a bad value for octave in
    the KeyPoint class. If you print ... to I think SIFT sets a bad
    value for octave in the @KeyPoint@ class. If you prin... More
-   Category set to nonfree
-   Tracker changed from Bug to Feature
```
Repository: opencv
Issue: convolveDFT example code in documentation is incorrect
Labels: bug,auto-transferred,priority: normal,category: core,affected: 2.4

Transferred from http://code.opencv.org/issues/2997

```
|| Alan Gardiner on 2013-04-30 02:45
|| Priority: Normal
|| Affected: 2.4.5 (latest release)
|| Category: core
|| Tracker: Bug
|| Difficulty: None
|| PR: 
|| Platform: None / None
```
## convolveDFT example code in documentation is incorrect

```
The size that is allocated for the resulting matrix in the convolveDFT example code is incorrect and at best misleading.  In order to perform a full 2D convolution the size of Mat C should not be 
<pre>
void convolveDFT(InputArray A, InputArray B, OutputArray C)
{
// reallocate the output array if needed
C.create(abs(A.rows - B.rows)+1, abs(A.cols - B.cols)+1, A.type());
... 
</pre>
as indicated in the dft documentation. This example code only gives the convolution where the images are completely overlapped.  In the limiting case where A and B are the same sizes, this code gives a single point, which is not very useful.   
A beginning image processing class teaches that the result of convolving images or matrices A and B should be
<pre>
C.create(A.rows + B.rows-1,A.cols + B.cols-1, A.type());
</pre>
```
## History
##### Anna Kogan on 2013-05-07 08:23

```
Hello Alan,
Thank you for reporting the issue. If you send a corresponding "pull request":http://www.code.opencv.org/projects/opencv/wiki/How_to_contribute in our GitHub repo would be highly appreciated!

-   Description changed from The size that is allocated for the
    resulting matrix in the convolveDFT exampl... to The size that is
    allocated for the resulting matrix in the convolveDFT exampl... More
-   Assignee set to Alan Gardiner
-   Category set to core
```
Repository: opencv
Issue: cv::TriangulatePoints()
Labels: auto-transferred,priority: normal,feature,category: calib3d

Transferred from http://code.opencv.org/issues/2998

```
|| Ander Biguri on 2013-04-30 09:29
|| Priority: Normal
|| Affected: None
|| Category: calibration, 3d
|| Tracker: Feature
|| Difficulty: None
|| PR: 
|| Platform: None / None
```
## cv::TriangulatePoints()

```
I am new to this so not sure If doing this correctly. 

I think openCV needs the @triangulatePoints()@ function to be developed more. It needs documentation and flags, among different method implementation, such as Linear/iterative LS ,Linear/iterative Eigen, Poly...
```
## History
##### Anna Kogan on 2013-05-07 08:17

```
Hello Ander, 
Thank you for reporting the issue. If you could implement such functionality on your side, a "pull request":http://www.code.opencv.org/projects/opencv/wiki/How_to_contribute in our GitHub repo would be highly appreciated!
```
Repository: opencv
Issue: libv4l capturing backend spams stderr with "HIGHGUI ERROR: V4L2:..."
Labels: bug,auto-transferred,priority: normal,affected: 2.4,category: videoio(camera)

Transferred from http://code.opencv.org/issues/3004

```
|| Hans Meine on 2013-05-03 09:00
|| Priority: Normal
|| Affected: branch 'master' (2.4.9)
|| Category: highgui-camera
|| Tracker: Bug
|| Difficulty: None
|| PR: 
|| Platform: None / None
```
## libv4l capturing backend spams stderr with "HIGHGUI ERROR: V4L2:..."

```
I have tried querying various properties from the capturing backend, but the libv4l backend defeats this by writing errors to stderr every time I try to access unsupported properties.

AFAICS, unsupported properties should be ignored (that is, setProperty returns false, but unfortunately, getProperty cannot do so ATM).  If I want to write a backend-independent client software, it is undesirable to get lots of errors on specific backends, no?

Even better would be to have a way to query (un)supported properties, e.g. by passing an optional bool* to getProperty, and let it write a success flag to that pointer if it is non-NULL.

Finally, I wonder whether these "ERROR"s fprintf's should have been CV_WARN()s like e.g. in cap_gstreamer.cpp.
```
## History
##### Hans Meine on 2013-05-03 09:02

```
BTW, I forgot to mention that issue #1984 seems to be slightly related, but I think it is more about a specific instance of this problem.
```
##### Anna Kogan on 2013-05-07 08:01

```
Hello Hans, 
Thank you for reporting the issue. If you can solve the issue on your side, a "pull request":http://www.code.opencv.org/projects/opencv/wiki/How_to_contribute in our GitHub repo would be highly appreciated!
-   Assignee changed from Vadim Pisarevsky to Hans Meine
```
##### Hans Meine on 2013-05-07 09:28

```
Hi Anna, does your comment imply that my thoughts are acknowledged?  I don't want to spend time on this if you don't agree.
```
##### Anna Kogan on 2013-05-07 09:30

```
-   Assignee changed from Hans Meine to Vadim Pisarevsky
```
Repository: opencv
Issue: Request: Bag of Words from precomputed keypoints and descriptors
Labels: auto-transferred,feature,priority: low,category: features2d

Transferred from http://code.opencv.org/issues/3005

```
|| antonio sesto on 2013-05-03 09:35
|| Priority: Low
|| Affected: None
|| Category: features2d
|| Tracker: Feature
|| Difficulty: None
|| PR: 
|| Platform: None / None
```
## Request: Bag of Words from precomputed keypoints and descriptors

```
Hello,
 the API for implementing an algorithm based on the Bag-of-Words (BoW) approach does not contain anything for computing the BoW representation of an image from a pre-computed vocabulary, a pre-computed set of keypoints, and a pre-computed set of descriptors.

Once the vocabulary has been computed, the only available class for producing a BoW representation of an input image is:
[[http://docs.opencv.org/modules/features2d/doc/object_categorization.html?highlight=descriptorextractor#bowimgdescriptorextractor]]
that requires an extractor and a matcher.

Even if it is not hard to overcome this limitation, it would be a nice addition a class where you only need to specify the vocabulary and the descriptors.
```
## History
##### Anna Kogan on 2013-05-07 07:59

```
Hello Antonio, 
Thank you for reporting the issue. If you could fix the problem on your side, a "pull request":http://www.code.opencv.org/projects/opencv/wiki/How_to_contribute in our GitHub repo would be highly appreciated!
-   Assignee set to antonio sesto
-   Category set to features2d
```
Repository: opencv
Issue: Counterintuitive comparison of matrices with NaN values
Labels: bug,auto-transferred,priority: low,category: core,affected: 2.4

Transferred from http://code.opencv.org/issues/3011

```
|| Leonid Beynenson on 2013-05-06 13:17
|| Priority: Low
|| Affected: branch '2.4'
|| Category: core
|| Tracker: Bug
|| Difficulty: None
|| PR: 
|| Platform: None / None
```
## Counterintuitive comparison of matrices with NaN values

```
At the moment element-wise comparison of matrices works in OpenCV as follows:

* the comparison operations @A < B@ (and @A > B@) are calculated element-wise 
* but the comparison operations @A <= B@ (and @A >= B@) are calculated as the logical negation of the compariosn @A > B@ (correspondingly, @A <B@)

(see the code of the function @cv::compare@ in the file source:modules/core/src/arithm.cpp and the template function @cmp_@ in the same file)

Since in C++ the operations @<@, @>@, @<=@, and @>=@ with NaN values always return @false@, there is the following counterintuitive behavior: 
if a matrix A contains only NaN values, we will have
<pre>
countNonZero(A < 0.5) ==> 0;
countNonZero(A > 0.5) ==> 0;
countNonZero(A <= 0.5) ==> A.total();
countNonZero(A >= 0.5) ==> A.total();
</pre>

This may be fixed if the comparison functions will make element-wise calculations for non-strict inequalities too. But in this case all the optimizations (SSE, etc) should be changed too.
```
## History
Repository: opencv
Issue: Orb detector-Number of detected areas-BAD formulation
Labels: bug,auto-transferred,priority: normal,affected: 2.4,category: features2d

Transferred from http://code.opencv.org/issues/3017

```
|| Zoltan Prohaszka on 2013-05-11 15:37
|| Priority: Normal
|| Affected: 2.4.0 - 2.4.4
|| Category: features2d
|| Tracker: Bug
|| Difficulty: None
|| PR: 
|| Platform: None / None
```
## Orb detector-Number of detected areas-BAD formulation

```
The detector phase of the ORB method detects many-many keypoints. 
It is far too much for most of the applications, so it contains 
an algorithm to keep the few best keypoints.

This part of the algorithm is bad in the 2.4.4 version. 
It assumes that a given scale would have a portion of required number
of keypoints proportional to the linear scale of the scale. 
The proper would be proportional to the square of the linear scale. 
I tested it, the corrected formulation performs much better 
in a registration application. I did not remember wether the basic ORB 
article is describing such details or not. 
The corrected code (original commented):
orb.cpp:
static void computeKeyPoints(const vector<Mat>& imagePyramid,
                             const vector<Mat>& maskPyramid,
                             vector<vector<KeyPoint> >& allKeypoints,
                             int nfeatures, int firstLevel, double scaleFactor,
                             int edgeThreshold, int patchSize, int scoreType )
{
    int nlevels = (int)imagePyramid.size();
    vector<int> nfeaturesPerLevel(nlevels);

    // fill the extractors and descriptors for the corresponding scales

        //calculate desited numbers per scale:
        //original:
//    float factor = (float)(1.0 / scaleFactor);
//    float ndesiredFeaturesPerScale = nfeatures*(1 - factor)/(1 - (float)pow((double)factor, (double)nlevels));
        //Modification:
    float factor = (float)(1.0 / scaleFactor);
        float factor2D=factor*factor;//scalefactor is linear, factor is areal
    float ndesiredFeaturesPerScale = nfeatures*(1 - factor2D)/(1 - (float)pow((double)factor2D, (double)nlevels));
        //                                       ratio: curr_scale/all      correction since the series doesnt sum to infinity

Our projects needs the corrected functionality
under Android too. I do not know when will I be able to 
get my GIT working properly, so if anybody would be so kind 
to modify the source please do it and give feedback!

Best regards
zol
```
## History
##### Rui Marques on 2013-11-26 12:57

```
This seems like a useful patch, anyone cares to make a pull request?
```
Repository: opencv
Issue: SVD in Lapack is suboptimal, by means of Givens rotations vs. Hauseholder mirroring
Labels: auto-transferred,priority: normal,feature,category: core

Transferred from http://code.opencv.org/issues/3018

```
|| Zoltan Prohaszka on 2013-05-11 16:17
|| Priority: Normal
|| Affected: None
|| Category: core
|| Tracker: Feature
|| Difficulty: None
|| PR: 
|| Platform: None / None
```
## SVD in Lapack is suboptimal, by means of Givens rotations vs. Hauseholder mirroring

```
Most Multiple View Computer Vision Algorithms have to 
solve overdetermined homogeneous linear equations, for 
which Singular Value Decomposition (SVD) is the proper method. 

The SVD implementation given in Lapack achieves band diagonal shape 
by applying Givens rotations. Hausholder mirroring transformations 
can zero a partial row for once, not only one element, thus there are 
faster by a factor of n. (the smallest size of the input matrix)

A typipical 3D reconstruction algorithm may spend many time by finding inliers
of a proper motion stereo model by RANSAC. 
For a not so easy image pair, RANSAC (inside findfundamental()) 
executes 8x8 SVD several hundred times. 

An other example, the JAMA package of NIST uses Hauseholder transformations.
(I attach a commented version of the algorithm, and the original 
file also). The JAMA package have another attractive feature regarding 
the eigenvalue-decomposition of non-symmetric matrices: It contains 
the random step introduced by the MATLAB team to avoid the algorithm to stuck.
(It can be tested by big permutation matrices). 

The JAMA package comes with very liberate licence. 
It has also disadvantages:
-Most numerical loops are designed to work only with rectangular matrices of 
one orientation ('landscape' or 'portrait'), so wrapper routines would be needed
for universal functionality. 
-It is not implemented to take advantage of SIMD or multithreaded execution. 
-It contains some calculations which give numeric stability very near to 
the margin of floating numeric represantations, but results slower execution 
in other, common cases (hypot and division instead of multiplication by reciprocal). 
I did not analize how unsafe the faster versions would be, so I did not modify these
for my versions.

I would like to ask for the opinion of the community, how the better functionality
should be incorporated in openCV. 

Regards:
zol

I set the priority normal because SVD is executed frequently. Otherwise I would give Low.
```
## History
Repository: opencv
Issue: Mask threshold inconsistent over pyramids in orb detector
Labels: bug,auto-transferred,priority: normal,affected: 2.4,category: features2d

Transferred from http://code.opencv.org/issues/3037

```
|| Timo Breuer on 2013-05-19 12:45
|| Priority: Normal
|| Affected: 2.4.5 (latest release)
|| Category: features2d
|| Tracker: Bug
|| Difficulty: None
|| PR: 
|| Platform: None / None
```
## Mask threshold inconsistent over pyramids in orb detector

```
The user provided mask for the feature detector is scaled the same way as the image, but additional thresholding is done. 

@threshold(maskPyramid[level], maskPyramid[level], 254, 0, THRESH_TOZERO);@

The value of 254 sets all entries below to zero, which is a problem if the mask has not been created with entries of 0 and 255. Using a mask with entries of 0 and 1 yields keypoints on level 0 only, so the user is left with an error that is hard to track down.

Possible fixes: Set the threshold to 1 or set all non-zero entries of the original mask to 255.
```
## History
Repository: opencv
Issue: GenericIndex  lsh parameters wrong
Labels: bug,auto-transferred,affected: 2.4,category: flann

Transferred from http://code.opencv.org/issues/3038

```
|| caron lee on 2013-05-20 02:14
|| Priority: High
|| Affected: 2.4.5 (latest release)
|| Category: flann
|| Tracker: Bug
|| Difficulty: None
|| PR: 
|| Platform: None / None
```
## GenericIndex  lsh parameters wrong

```
Code:
    cvflann::LshIndexParams params;
    pIndex = new GenericIndex<D_L2_float>(feature, params);
I tried the default LshIndexParams constructor or with parameters: LshIndexParams params(xx,xx,xx), but all those lead to a exception in : 
    modules/flann/include/opencv2/flann/params.h:63
the line is :  
    return it->second.cast<T>();
When I used gdb to get more information, I found that in the function get_param [modules/flann/include/opencv2/flann/params.h:59] 
the params variable was right:
  {
      ...
      ["key_size"] = {policy = 0xbdec68, object = 0x14},
      ["multi_probe_level"] = {policy = 0xbdec68, object = 0x2},
      ["table_number"] = {policy = 0xbdec68, object = 0xc}
  }
but when I print the 'it' variable, I got:
   p it
      $16 = {first = "table_number", second = {policy = , object = }}
the second attribute was missing, and the it->second raised exception.
```
## History
##### Andrey Pavlenko on 2013-05-22 07:07

```
-   Start date deleted (2013-05-20)
-   Priority changed from Blocker to High
-   Assignee set to Marius Muja
-   Category set to flann
```