separating an image into two images
조회 수: 23(최근 30일)
Rik 2018년 4월 27일
Convert the image to a grayscale (e.g. with im2double), invert (just do IM=1-IM;), and find the columns that sum to 0. Then you can use that as indices to separate the images.
John BG 2018년 5월 6일
this is John BG <mailto:email@example.com firstname.lastname@example.org>
In order to split the image as requested there's no need to convert the image to greyscale.
The key is to spot the white gap between both images.
clear all;close all;clc
[sz1 sz2 sz3]=size(A)
Only along the split area all pixels are white meaning that only there the sum is about
It's a bit less because not all gap pixels are 255 white, but their values are the closest ones to the top value 255.
The following calculates the sum of all pixels column by column.
The gap to split the image is the middle one
A way to get right the mid point of the split gap is with command kmeans.
Now you can cut:
Saving each part
if you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance for time and attention