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
 loop trough all pixels and change values
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

scpsolutions

Canada
6 Posts

Posted - Jan 28 2023 :  17:19:40  Show Profile  Reply
Hi Everyone,

I have a bunch of images, thousands actually. And I need to make sure the background is pure white. I know how to get the images and scan folders and all that stuff. Just not sure how to modify individual pixels. Not looking for speed, as long as it works.

I know this will get subject and non-background pixels. But this will be one step of many so if the subject is modified will have to resort to photoshop or something maybe.

Example pseudo code

for w as image.width
  for h as image.height
   if image.pixel[w][h].r >=250 and  image.pixel[w][h].g > 250 and image.pixel[w][h].b > 250
   begin  //pixel is near white so force it to white
    image.pixel[w][h].r=255
    image.pixel[w][h].g=255
    image.pixel[w][h].b=255
    imagechanged=true
   end


Just to recap, just looking to loop trough all pixels and check pixel values and if they fit a criteria, change them.

Thanks!
Marc



Marc Ouellette

xequte

38692 Posts

Posted - Jan 29 2023 :  16:58:16  Show Profile  Reply
Hi Marc

In terms of making colors close to white, purely white, you can use:

http://www.imageen.com/help/TImageEnProc.Threshold.html

But that will apply to the whole image (or whatever is selected), so naturally it will also whiten any any near white parts of the image subject.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

scpsolutions

Canada
6 Posts

Posted - Jan 29 2023 :  21:22:23  Show Profile  Reply
HI Nigel,

That is just what I am looking for.

Thank you so much!

Marc

Marc Ouellette
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: