ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to read color values of pixels in image?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
727 Posts

Posted - Jan 23 2019 :  02:40:32  Show Profile  Reply
Hello,

This is for the first time that I have a need to actually scan all the pixels of the loaded image and select pixels based of a few rules as defined by user.

How can we read the individual values of R G B of each pixel and select those pixels as per user entered rules?

TIA


Yogi Yang

klausdoege

Germany
389 Posts

Posted - Jan 23 2019 :  03:48:29  Show Profile  Reply
Hi Yogi,
use: TImageEnView.SelectCustom

Example:
for y := 0 to ImageEnView1.IEBitmap.Height - 1 do
  for x := 0 to ImageEnView1.IEBitmap.Width - 1 do
  begin
    color := ImageEnView1.IEBitmap.Pixels[x, y];
    if ( color = clBlue ) or ( color = clGreen ) then
    begin
      ImageEnView.SelectionMask.SetPixel(X, Y, 255);
      ImageEnView.SelectCustom();
    end;
  end;


Klaus
www.klausdoege.de
Go to Top of Page

yogiyang

India
727 Posts

Posted - Jan 23 2019 :  06:52:03  Show Profile  Reply
Klaus,

Thanks for the code sample. I finally managed to get it working and it is quite fast also!

Once again thanks of the code.

TIA


Yogi Yang
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: