[vtkusers] Suggestions on extracting certain pixels by color

Arturo Caissut arturo_caissut at tiscali.it
Wed Feb 11 18:46:46 EST 2009


Hi,
I thought about a different method, and I'd like to know what do you 
think about it: as I say my aim is to get areas of pixel colored with a 
certain RGB value from a vtkImage.
What about vtkExtractComponents to obtain three different images (one 
for each component) and then three vtkImageThreshold?

Something like:
|
threshold0->SetInput($FIRST_COMPONENT);
||threshold0->ThresholdBetween(rgb[0], rgb[0]);

threshold1->SetInput($SECOND_COMPONENT);
||threshold1->ThresholdBetween(rgb[1], rgb[1]);

threshold2->SetInputConnection($THIRD_COMPONENT);|
|threshold2->ThresholdBetween(rgb[2], rgb[2]);|

Then I could "merge" the three threshold filters' output with a kind of 
"double &&" operation on their pixels, I think.

Do you see any weak points in such an approach?

Arturo


Francois Bertel wrote:
> First the first part, If your OpenGL colorbuffer comes from a
> vtkRenderWindow, use GetPixelData() or GetRGBAPixelData() methods of
> this class instead. They actually use glReadPixels().
>
> http://www.vtk.org/doc/nightly/html/classvtkRenderWindow.html
>
>
> On Fri, Jan 16, 2009 at 2:56 PM, Arturo Caissut
> <arturo_caissut at tiscali.it> wrote:
>   
>> Hi everyone,
>>
>> I need to extract a certain region from an OpenGL buffer of pixels. As
>> certain people suggests on the Internet, first of all I used OpenGL's
>> glReadPixels function to copy all of the interesting area's pixels to a
>> buffer, and then I used vtkImageImport. Now I'd like to separate all the red
>> pixels (by "red" I mean their RGB value to be 1, 0, 0) and put them on some
>> vtkObject (later I'll have to get contour of the red area of the image I'm
>> working on).
>> How can I separate red pixels from the rest of the buffer?
>> Have I got to use something similar to a threshold filter?
>> Perhaps there is some vtkImageImport method to do that from the beginning of
>> my vtk pipeline?
>>
>> Thank you, best regards
>>
>> Arturo Caissut
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>     
>
>
>
>   




More information about the vtkusers mailing list