DSPRelated.com
Forums

coin counter

Started by Matthew April 4, 2006
Hello, im new to all matlab functions and what im trying to do is
create a coin counter.

First off I want to change my photo of coins using

IGB2gray then convert it using im2bw

the problem im having is that i want the background to change to
black and the coins to turn to white, but i seem to be having the
opposite reaction.

I = imread('H:\image\simple.png');
J = rgb2gray(I);
figure, imshow(I), figure, imshow(J);

I = imread('H:\image\simple.png');
level = graythresh(I);
BW = im2bw(I,level);
imshow(BW)

and then fill it with an imfill function

this is my image if your curious
http://i6.photobucket.com/albums/y232/manicpreacher/simple.png

any help with just flipping the way it changes it to black and white
would be great :D thanks!!
Hi,

try this :

imshow(1-BW)

Je