Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: changing background in .jpg to white without changing object
Replies: 1   Last Post: Jul 14, 2013 8:00 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Loren Shure

Posts: 977
Registered: 12/7/04
Re: changing background in .jpg to white without changing object
Posted: Jul 14, 2013 8:00 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


"Rafal " <hsuahsua@haha.pl> wrote in message
news:krpbct$81q$1@newscl01ah.mathworks.com...
> Hello,
> How can I change the background in my .jpg from for example: grey to white
> without change photographed object?
>
> Assume that I click on the image and select the background (level of
> greyness)
>
> L1 = imread('image.jpg');
> L1 = double(L1)/255;
> imshow(L1)
> [x,y]=ginput(1);
> y=round(y);
> x=round(x);
> p = L1(y,x,: ); ...
> ..
> ..
> I have no idea what is next :/
>


I am NOT an image processing expert. But you may want to do something like
a replace pixels "near" that color - unless some of the object also has that
color. Then you might try to fill that region instead. But to do so, you
would first have to convert to black and white - fill and find what was
filled, then transform back to color. Not sure how you find which pixels
were updated in B&W except by comparing before and after.

http://www.mathworks.com/help/images/ref/imfill.html

I'm sure someone more well versed in image processing can give you an easier
way...

--
--Loren

http://blogs.mathworks.com/loren




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.