Prev: Position, TightInset and OuterPosition in a subplot
Next: Simulink + embedded matlab function + matrix indexing
From: Branko on 3 Dec 2009 05:47 "Mitja " <kastelic.mitja(a)gmail.com> wrote in message <hf82i8$p5$1(a)fred.mathworks.com>... > Hello! > > Well, I looked at the demo http://www.mathworks.com/matlabcentral/fileexchange/25157 and I find par of code that is interesting to me (!!!foregroud and backgroud!!!): > > % Threshold the image to get a binary image (only 0's and 1's) of class "logical." > % Method #1: using im2bw() > % normalizedThresholdValue = 0.4; % In range 0 to 1. > % thresholdValue = normalizedThresholdValue * max(max(originalImage)); % Gray Levels. > % binaryImage = im2bw(originalImage, normalizedThresholdValue); % One way to threshold to binary > % Method #2: using a logical operation. > thresholdValue = 100; > binaryImage = originalImage > thresholdValue; % Bright objects will be the chosen if you use >. > % binaryImage = originalImage < thresholdValue; % Dark objects will be the chosen if you use <. > > % Do a "hole fill" to get rid of any background pixels inside the blobs. > binaryImage = imfill(binaryImage, 'holes'); > > > I dont know yet how to implement this code to may project. I thought i could use a portret of some person on blue or white background. This would be initial picture. The plan would be next: 1. I would made face recognition 2. frequential mask 3. Color mask 4. fusion and markers placement (white for foregroung and black for background) 5. alpha matte estimated 6. hair segmentation. It was taken from that article: http://www-video.eecs.berkeley.edu/Proceedings/ICIP2008/pdfs/0002276.pdf > > > if its posible I would do it in less steps if it's posible. Have you looked this it may help you: http://www.cs.huji.ac.il/~yweiss/Colorization/ Branko
From: Mitja on 8 Dec 2009 04:04 Hello! I looked this example. I have opened the matlab code and its not working! in -------------------------------------------------------------------- cheapUI.m writs an error: ??? Input argument "im1" is undefined. Error in ==> cheapUI at 3 gg=rgb2gray(im1); -------------------------------------------------------------------- in colorize.m if I insert some other picture it doesn't work! error: ?? Error using ==> rgb2ntsc>parse_inputs at 76 RGBMAP must be an M-by-3 array. Error in ==> rgb2ntsc at 29 A = parse_inputs(varargin{:}); Error in ==> colorize at 15 sgI=rgb2ntsc(gI); ----------------------------------------------------------------------- in colorizeFun.m puts next error: ??? Error using ==> rgb2ntsc>parse_inputs at 76 RGBMAP must be an M-by-3 array. Error in ==> rgb2ntsc at 29 A = parse_inputs(varargin{:}); Error in ==> colorizeFun at 16 sgI=rgb2ntsc(gI); I would really need some help, becouse I dont know what to do!!!
From: ImageAnalyst on 8 Dec 2009 06:21 I don't know - I didn't run it. But are you sure you're giving it an rgb image and not a monochrome image? Maybe that would cause the error (but I doubt it).
From: Mitja on 14 Dec 2009 04:44
well i tried with this code. The problem is that, that works only on this picture (geeks.jpeg). If I change to any other picture, the code doesnt work any more and I cant find why!!! Can anybody pleese help me!? http://www.kyb.mpg.de/bs/people/kienzle/fdlib/fdlib.htm downaload: - fdlib for Matlab (Windows) |