How do I create a halftoning effect in MATLAB?
Mostra commenti meno recenti
How to make an image with halftoning effect that uses 75 lpi?
2 Commenti
Chaowei Chen
il 27 Ago 2011
http://www.mathworks.com/matlabcentral/fileexchange/25303-image-halftoning-by-jarvis-method
harjan
il 28 Ago 2011
Risposte (2)
Saneem Ahmed
il 28 Ago 2011
0 voti
9 Commenti
harjan
il 28 Ago 2011
Walter Roberson
il 29 Ago 2011
Code is a particularly stylized method of describing a formula.
harjan
il 29 Ago 2011
Walter Roberson
il 29 Ago 2011
What parameter values need to be chosen? If you are concerned about the 75 not being correct on some screens, then
get(0,'ScreenPixelsPerInch')
will return the resolution of the first monitor of the current display.
harjan
il 30 Ago 2011
Walter Roberson
il 30 Ago 2011
It appears newspapers are more often 85 lpi, which I estimate requires approximately 400 dpi at minimum.
http://en.wikipedia.org/wiki/Halftone
harjan
il 31 Ago 2011
Walter Roberson
il 31 Ago 2011
fx and fy would be 400 for a screen or printer frequency of 400 dpi.
I did not attempt to locate a formula relating dpi and lpi with halftoning: it would depend upon what dot shape you were using and upon the cross-angle you were using. What I did is look at the table in that Wikipedia link and then did a linear interpolation between the 300 dpi and 600 dpi figures to estimate the minimum dpi that could handle 85 lpi (since the 600 dpi had 85 lpi as a lower bound, going up over 100 lpi, implying that you would be able to do 85 lpi with a lower dpi.)
harjan
il 2 Set 2011
DGM
il 27 Ott 2022
I'm going to completely ignore the issue of LPI and DPI. Something tells me that 20 people per month don't actually intend to feed this to a printer.
imgscale = 2; % scales the image
htmscale = 7; % scales the map WRT the image
% get an image and prepare it
inpict = imread('peppers.png');
inpict = im2double(rgb2gray(inpict));
inpict = imresize(inpict,imgscale);
% create constant-frequency map
s = size(inpict);
sc = imgscale*htmscale;
[xx yy] = meshgrid(1:s(2),1:s(1));
htm = 0.5*((cos(xx*2*pi./sc).*cos(yy*2*pi./sc))+1);
% perform thresholding
mask = inpict>htm;
% display it
imshow(mask)

Categorie
Scopri di più su Image Processing Toolbox in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!