フィルターのクリア

How to transfer color and texture of an image to another image?

5 ビュー (過去 30 日間)
NAVNEET NAYAN
NAVNEET NAYAN 2024 年 6 月 22 日
コメント済み: NAVNEET NAYAN 2024 年 6 月 25 日
I have two RGB images. One is input image and other one is target image. Please find attached the image files. I want to transfer the color and texture of the input image to the target image.
Can someone suggest some solution?

採用された回答

DGM
DGM 2024 年 6 月 22 日
編集済み: DGM 2024 年 6 月 22 日
There are no MATLAB tools that will do good blind transfer of color themes, let alone textures. There are examples of technical papers if you want to implement one. MIMT also has a luma-correlated color transfer tool of very limited utility. There are links and previews of both here:
That said, it's not clear what you even expect the results to look like. One picture is a giant image of hairy skin. The other is a tiny blurry picture of what appear to be distant french fries in darkness. The goals aren't obvious.
  4 件のコメント
DGM
DGM 2024 年 6 月 24 日
編集済み: DGM 2024 年 6 月 24 日
TFW the french fries you were looking at turn out to be disembodied legs ...
Weeell okay. I don't know what you're doing with it, but if it's not too critical, the tone can be sort of matched.
Unless you want to deal with jagged masking problems, you can try something like this.
% the inputs
ref = imread('Input_Image.jpg');
target = imread('Target_Image.jpg');
% don't need all the padding for a demo
target = imcrop(target,[53.51 54.51 98.98 47.98]);
% show it
imshow2(target,'invert')
% replace HS distributions with IPT imhistmatch()
% assuming both images are RGB
outpict = rgb2hsv(target);
ref = rgb2hsv(ref);
for c = 1:2
outpict(:,:,c) = imhistmatch(outpict(:,:,c),ref(:,:,c));
end
outpict = im2uint8(hsv2rgb(outpict));
% show it
imshow2(outpict,'invert')
That's most of the way there, but maybe the lightness is a bit off it might be better or worse depending on the images being used. There are some cheap tricks that can be done to correct for that, but if we're sticking to IPT alone, they're mostly not worth the effort.
MIMT imrecolor() does a good job at retaining brightness/contrast because of the way it works. That also means that the black background isn't a hazard.
% recolor in a specified color model with MIMT tools
outpict = imrecolor(ref,target,'colormodel','hsly');
% show it
imshow2(outpict,'invert')
NAVNEET NAYAN
NAVNEET NAYAN 2024 年 6 月 25 日
Thank you so much for solving the problem and informing about MIMT toolbox.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2024 年 6 月 23 日
  1 件のコメント
NAVNEET NAYAN
NAVNEET NAYAN 2024 年 6 月 24 日
Thank you @Image Analyst for your response. I shall look into the links provided by you.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by