How to make the white background whiter and black prints blacker and remove the highlight color (green) in an image?

6 visualizaciones (últimos 30 días)
IMG_1549.JPG

Respuestas (1)

DGM
DGM el 26 de Abr. de 2023
Editada: DGM el 26 de Abr. de 2023
I've seen this post before and I always pass it up because it's such a bad image.
The image content has been pretty much destroyed. It was once saved by a camera in JPG and then again it was likely transcoded by some program to an even lower-quality JPG. The final encoding is a roughly 40% quality 4:2:0 subsampled pixel salad. Maybe someone who is more familiar with the language could visually identify the characters based on their rough shape and the surrounding context, but I couldn't.
Still, I might as well give it a shot. Let's start by doing a perspective correction and getting rid of the background. That way we don't have to deal with it skewing all the adjustments.
% this JPG is complete trash ~40% Q, 4:2:0 subsampled
% there is no hope of actually making this readable again
inpict = imread('IMG_1549.jpeg');
inpict = im2double(inpict); % work in FP
% these are the coordinates of the box corners
boxm = [75 161; % [x y]
1 1420;
1020 1430;
945 145];
% assert that this is where they're supposed to be
boxf = [1 1; % [x y]
1 1440;
1080 1440;
1080 1];
% do projective transformation
TF = fitgeotrans(boxm,boxf,'projective');
outview = imref2d(size(inpict));
inpict = imwarp(inpict,TF,'fillvalues',0,'outputview',outview);
Create a mask to try to select the blue highlighter marks. Again, this is more or less hopeless, since most of the chroma information (H and S) has been reduced to 20x20px blocks. The best we can do is get a rough mask and feather it.
% create mask roughly selecting the highlighted area
[H,~,~] = imsplit(rgb2hsv(inpict));
mk = H >= 0.367 & H <= 0.784;
% feather the mask outward since region boundaries are garbage
mk = imdilate(mk,ones(3));
mk = imgaussfilt(double(mk),2);
Try to correct for the highlighter marks:
% reduce image to gray, adjust levels/gamma in ROI
gpict = rgb2gray(inpict);
adjpict = imadjust(gpict,[0.1 1],[0 1],0.55);
% composite images to create gray image without highlighter marks
outpict = replacepixels(adjpict,gpict,mk);
Try to flatten the result:
% flatten image using 'grain extract' blending
% use a sum of gaussian filter (this could be simplified)
lf1 = imgaussfilt(outpict,5);
lf2 = imgaussfilt(outpict,20);
lowfreq = imblend(lf1,lf2,1,'average');
outpict = imblend(lowfreq,outpict,1,'grainextract');
% adjust levels/gamma
outpict = imlnc(outpict,'independent','g',0.8,'k',2);
Could I get more contrast out of it? Perhaps, but it's hard for me to judge at which point readability is being compromised (if it's not already a lost cause). For example, instead of performing flattening via a single 'grain extract' blend, we could use multiple techniques and combine them. The 'grain extract' method has weakness in some of the dark regions, whereas other regions tend to cause problems for the division used by imflatfield(). By using both, we can try to avoid the low-contrast problems in the SW corner.
% flatten image using 'grain extract' blending
% use a sum of gaussian filter (this could be simplified)
lf1 = imgaussfilt(outpict,5);
lf2 = imgaussfilt(outpict,20);
lowfreq = imblend(lf1,lf2,1,'average');
flat1 = imblend(lowfreq,outpict,1,'grainextract');
% flatten image using imflatfield() (division)
flat2 = imflatfield(outpict,7);
% stretch and average the two flattened images
outpict = imblend(imadjust(flat1),imadjust(flat2),1,'average');
% adjust levels/gamma
outpict = imlnc(outpict,'independent','g',0.8,'k',2);
... but I don't know if that's really any better.
In this example, I'm using imlnc(), imblend() and replacepixels() from MIMT, though both could be done directly with little effort. I've posted examples on the forum before which show how to do what imlnc() and replacepixels() do. The 'grain extract' blend is simple enough to figure out.
  1 comentario
DGM
DGM el 26 de Abr. de 2023
Editada: DGM el 26 de Abr. de 2023
Just out of curiosity, OCR gives me this:
新加坡旅游签证材料:
1.影版還有一部(有效制整频亦為申请之日起满6个月以
2.护照复印件两份所有文子和信息必湖清楚简示,(必須是复印版本或者清晰 书 打印的版本,不可以用手机拍照然后打印出来的图片,
3.西豐華小±3mm*45mm)商城彩色照片的冲印件(二个月内拍摄,申请人 的头发刘海不能遣盖化被失和两侧耳朵,戴眼镜的申请人镜片不能有反光,逗低
4.新加坡签证申请表(FORM14A) 一份,用A4纸分页打印成三张(不可以正 我打印,用黑色或蓝色水笔手工填写,如填错不可以修改,需重新打印填写。 表格时内容填写参考“填写范本PDF"
5.身份证正反面复印件一份(16周岁以下未办理身份证的申请人提供出生证明
6、申请人本人向民户口本的整本复印件
7.申请人若是在时人员,提供在职证明原件(具体要求详见“在职证明模板"), 查非法人和个体经营者需提供营业执照复印件并加盖公版 b申请人若是退休人员,提供退休证复印件,并在复印件的空白处备注每个月的 退休工既金物 c申请人若是无业人员,需提供银行开局的存款证明原件,存款金额建议不低于 人民币五万元(做了此金额有拒签风险) 可请人若是学生,需提供所在学校开具的在读证明原件(具体要求详见“在读 证明模板“,个别学校若无法开具在读证明,则必须提供学生证的复印件或学糖 长复印件,复印件上必买清楚的反映出在读人员的详细学籍信息 • 申请人若是7周岁以下儿童,且不是父母双方陪同前往新加坡的,需要提供父 母双方的护照首重复印件或身份证复印件及孩子的出生证明复印件
8、申请人若在申请签证时只提供了自己的签证材料但同时有其他一起出行的, 提提供同行人的护照首页和签证更(如果已经取的)。并备注同行人与自己的关
*如果申请人的护照签发地不属于江浙沪心四地中的任意一个,视为外领区人员。 此类申请人险需准备以上材料外,还至少需要提供在江浙沪能四地的城市居住满 半年以上的有效证明复印件 公司为其代繳的半年以上社保单据流水证明。
... which translates to this:
Singapore tourist visa material:
1. There is also a film version (the effective entire frequency is also the day when the application is also 6 months from the application
2. There are two copies of the passport copy of all Wenzi and information.
3. Xifenghua Primary ± 3mm*45mm) Printing of the color photos of the mall (taken within two months, the applicant's hair bangs cannot be sent to the lost and the ears on both sides, the lens wearing glasses can not have reflection, Low
4. One Singapore Visa Application Form (FORM14A), print it into three pieces with A4 paper pages (you can't print it in just me, and fill in hand -made with black or blue water pen. Refer to the content refer to "Fill in the template PDF"
5. A copy of the front and back of the ID card (applicants who do not apply for an ID card under 16 years of age provide birth certificate
6. The applicant himself to the entire copy of the public account
7. If the applicant is at the time of personnel, provide the original on -the -job certificate (see the "On -the -job Certificate Template" for details), check the unincorporated person and individual operator to provide a copy of the business license and stamp the public version B. If the retirees are retirees, if the retirees, if the retirees, if the retirees, if the retirees, the retirees,, if the retirees are retirees, they are retirees. Provide a copy of the retirement permit, and remark in the blank part of the copy, the annual retirement worker C applicants If the unemployed person, the original deposit certificate of the bank's start is required. The amount of deposit is not less than RMB 50,000 (do it There is a risk of refusal in this amount) but if the inviter is a student, the original reading certificate issued by the school must be provided (for details, please refer to the "Reading Certificate Template". Learning sugar long copies, the copy of the copy must be clearly reflected in the detailed student information of the students. If the applicant is under the age of 7 and not accompanied by both parents to Singapore, you need to provide the first copy of your parents' passport or Copy of ID cards and children's birth certificate
8. If the applicant only provides his own visa materials when applying for a visa, but at the same time there are other people traveling together, the homepage and visa of the passport of the peers (if it has been taken). And remarks the passage of the same pedestrian and yourself
*If the applicant's passport is issued, it does not belong to any of the four places in Jiangsu, Zhejiang and Shanghai, and is deemed to be personnel in the foreigners. In addition to the above materials, such applicants need to prepare the above materials, they also need to provide at least a valid certificate for a relaxed company for more than half a year in cities in Jiangsu, Zhejiang and Shanghai, and more than half a year.
I expect the translation to be lossy, but I guess at least some of it is still machine-readable.

Iniciar sesión para comentar.

Categorías

Más información sobre Image Segmentation and Analysis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by