Skip to content

Conversation

@jhurliman
Copy link
Contributor

This forces images to be stored in memory as three channel (blue/green/red) images and fixes the Matrix::Row() and Matrix::Col() functions to return real 0-255 pixel values. The returned arrays will have a length of width_3 or height_3.

peterbraden added a commit that referenced this pull request May 5, 2012
Fix Matrix::Row() and Matrix::Col() to return proper BGR pixel values for images
@peterbraden peterbraden merged commit c13aa6a into peterbraden:master May 5, 2012
@jhurliman
Copy link
Contributor Author

Thanks for the merge. Any chance of getting a version bump and npm republish for this?

@peterbraden
Copy link
Owner

sorry, thought I'd done this. Done!

@peterbraden
Copy link
Owner

I've been using this a bit, and I'm not convinced that this is the right interface for row and col. It's weird that they return more vals than you expect.

Unless you have any objections, I'm gonna roll back, but I'll make a pixelRow and pixelCol method that do what you suggest.

@jhurliman
Copy link
Contributor Author

I am good with any approach that exposes the RGB values for each pixel
(it is difficult to do image analysis without that functionality). I
don't mind switching to new API methods. However, rolling back might
not be the best solution since the previous version was using OpenCV
incorrectly and returning garbage values. If you want to return
grayscale values where each pixel in a row or column is represented by
a single number, you need to either load the image in a different way
or combine the RGB values together.

On Thu, May 31, 2012 at 6:58 PM, Peter Braden
[email protected]
wrote:

I've been using this a bit, and I'm not convinced that this is the right interface for row and col. It's weird that they return more vals than you expect.

Unless you have any objections, I'm gonna roll back, but I'll make a pixelRow and pixelCol method that do what you suggest.


Reply to this email directly or view it on GitHub:
#2 (comment)

@peterbraden
Copy link
Owner

Good point, I didn't realise opencv stored images in matrices that way.

@peterbraden
Copy link
Owner

Perhaps you can help me understand:

  • If I'm storing RGB images, I want to use a CV_32FC3 matrix?
  • Rather than extracting a vector, could I do mat.at(x,y,c) where c is 1 to 3 for the colors?

I don't want to return a greyscale value, rather I'd like to return the 32 bit unsigned int that corresponds to #aabbcc for the color?

@peterbraden
Copy link
Owner

See c4a1c71 for changes to row and col.

peterbraden pushed a commit that referenced this pull request Feb 11, 2014
Added example for video feed applying gaussianBlur and canny edges filte...
Queuecumber pushed a commit that referenced this pull request Oct 30, 2015
IonicaBizau pushed a commit to IonicaBizauKitchen/node-opencv that referenced this pull request Oct 17, 2016
[20160421] sync to upstream/master
@djMax
Copy link

djMax commented Jan 7, 2017

How does one get rgb or r g and b from a jpg, for example? It's confusing and there are lots of similarly named methods...

bmathews pushed a commit to bmathews/node-opencv that referenced this pull request Feb 8, 2017
Different library include methods for windows vs osx
@dazhenseu
Copy link

How does one get rgb or r g and b from a jpg, for example? It's confusing and there are lots of similarly named methods...

Yes,me too. Can somebody give me an example to access rgb data from am image?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants