Problem merging two images

4 visualizaciones (últimos 30 días)
hu
hu el 15 de Oct. de 2014
Respondida: Karbala'a Unvi. Science el 21 de Nov. de 2014
Hi,
Why I can not merge these two images?
I = imread('peppers.png');
[height, width] = size(I);
blankImage = ones(height/5,width,3);
combineImg = [I; blankImage]
imshow(combineImg);
Thanks

Respuesta aceptada

Ben11
Ben11 el 15 de Oct. de 2014
Editada: Ben11 el 15 de Oct. de 2014
This will work:
clc
clear
close all
I = imread('peppers.png');
[height, width,Channels] = size(I)
blankImage = ones(round(height/5),width,Channels,'like',I);
combineImg = [I; 255*blankImage];
imshow(combineImg);
First you needed to round the height dimension, and then since the image is RGB it has 3 channels, so the 3rd output of 'size' is 3, hence you had a conflict when trying to concatenate.
Here is what I got as output. Notice that there is a white image at the bottom but it does not show up well here. Try it in Matlab and it will work.
EDIT: Here is what it look like with a black blankImage.To get it, change
combineImg = [I; 255*blankImage];
with
combineImg = [I;blankImage];
Output:
  4 comentarios
hu
hu el 15 de Oct. de 2014
Thanks, it working
Ben11
Ben11 el 15 de Oct. de 2014
ok great then!

Iniciar sesión para comentar.

Más respuestas (1)

Karbala'a Unvi. Science
Karbala'a Unvi. Science el 21 de Nov. de 2014
hi every one I have a cropped image from the original image. The cropped one is processed. Now I want to reteren that part to the original image.. the processing on the cropped image is not to much, it will not change so many things in the cropped image. Need for the help as fast as you can

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by