简体   繁体   English

MATLAB-如何将一个图像放在另一个图像上?

[英]MATLAB-How to put one image on another?

I have an image 我有一张图片

在此处输入图片说明

I have obtained its phase only reconstructed image using fftn function. 我已经使用fftn函数获得了仅相位重建的图像。

My aim is 我的目的是

  1. Using phase only reconstruction of the given image,i will get only edges and lines 使用给定图像的仅相位重建,我将仅获得边缘和线条

  2. Then i want to color these lines and edges say with red or blue color in the phase only reconstructed image. 然后我要在仅相位重建的图像中用红色或蓝色为这些线条和边缘着色。

  3. Then i want to put this "colored" image on original image so that edges and lines from the original images can be high-lightened with respective red or blue color. 然后,我想将此“彩色”图像放在原始图像上,以使原始图像的边缘和线条可以分别用红色或蓝色突出显示。

But when i run the code, i get following error 但是当我运行代码时,出现以下错误

'Subscript indices must either be real positive integers or logicals. '下标索引必须是实数正整数或逻辑值。

Error in sagar_image (line 17) superimposing(ph) = 255;' sagar_image(第17行)叠加(ph)= 255时出错;

So what should I do? 所以我该怎么做?

clc;
close all;
clear all;

img=imread('D:\baby2.jpg');
figure,imshow(img);
img=rgb2gray(img);

fourier_transform=fftn(img);%take fourier transform of gray scale image

phase=exp(1j*angle(fourier_transform));
phase_only=ifftn(phase);%compute phase only reconstruction
figure,imshow(phase_only,[]);

ph=im2uint8(phase_only);%convert image from double to uint8 
superimposing = img;
superimposing(ph) = 255;  
figure,
imshow(superimposing,[]), 

superimposing(ph) = 255 could mean - 1. ph contains indices of superimposing that you wish to paint white(255). superimposed(ph)= 255可能意味着-1。ph包含您希望绘制白色(255)的叠加索引。 2. ph is a 'logical' image of the same size as superimposing, every pixel that evaluates to 'true' in ph would be painted white in superimposing. 2. ph是与叠加大小相同的“逻辑”图像,每个在ph中评估为“ true”的像素在叠加时都会被涂成白色。

What you meant was probably: 您的意思可能是:

threshold = 0.2;
superimposing(real(phase_only) > threshold) = 255;

If you want to fuse the two images and see them one on top of the other use imfuse: 如果要融合两个图像,并在另一个图像上看到它们,请使用imfuse:

imshow(imfuse(real(phase_only), img, 'blend'))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MATLAB:如何将一个图像转换为另一个图像 - MATLAB: how to transform one image to another image 如何在matlab中将一个图像的相位与另一个图像的幅值合并并生成合并图像的逆 - How to combine phase of one image with magnitude of another image in matlab and generate the inverse of the combined image 如何将一个 svg 放入另一个? - How to put one svg in another? 如何使用MATLAB将图像的一部分颜色更改为同一图像的另一部分 - how to change the color of one portion of an image to another portion of the same image using MATLAB 一个图像在另一个图像上的映射:如何在Matlab中进行? - mapping of an image on another image :how to do in matlab? Android,如何将一个图像放在另一个图像上? - Android, How to put an image over another image? 精确替换图像中的一个像素,然后通过Swift将其放置在另一图像中 - Replace exactly one pixel in an image and put it in another image via Swift 如何使用CSS将功能区图像放置在另一个图像上? - How to put a ribbon image on another image with css? 如何在Matlab中沿特定方向模糊图像? - How to blur an image in one specific direction in Matlab? 如何将图像放在 tkinter 的另一个窗口中? - How to put image in another window in tkinter?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM