convert block cell to image

how to convert 8*8 non overlapping blocks into an image?

2 个评论

What do you mean exactly? Do you mean something like blockproc?
i've converted an image to blocks..now i want the image back using these blocks

请先登录,再进行评论。

回答(1 个)

Let I be your 8*8 cell block ..
iwant = cell2mat(I) ;

8 个评论

mat.PNG
when i applied the cell2mat function,i couldnt retrive the original image from the blocks
KSSV
KSSV 2019-8-16
编辑:KSSV 2019-8-16
Did you do any operations on the cell? How did you get 8*8 cells? From the image it looks like each cell is same.
the pic is when i tried to watermark the 8*8 blocks and rearrange the blocks back as an image
Show us the whole code you tried.
Your code starts with moderately useful comments and then quickly gives up. Unfortunately, the uncommented part is the one that need comments the most in order to understand what is going on.
I suspect that you've pieced this code together from various answers, without thinking much about the overall architecture. You need to review your code line by line and think if it makes sense. I would suggest that you run your code line by line using the debugger and after each line think: did this make sense? Was it actually useful?
e.g, at the start you get the size of the image as m,n (you already know what it is since you forced it to 512x512, but it's always a good idea to ask for it anyway), however on the next line you hardcode (wrongly!) the number of blocks. The number of blocks depend on the the size of the image.
Later on, you have the unnecessary variable counti and countj (they're always equal to i and j)
Then you have variables that are never used such as b and iwant.
I gave up trying to understand after that.
tq sir..i will use line by line debugger..i was trying to watermark an image ...im just a beginner and trying to learn matlab!
I'm sorry, due to the lack of explanation it would require too much of my time to try to understand your code, let alone find what is wrong with it. The first thing you need to do is comment your code, to explain what each major step is trying to do.
Okay sir..I would see step wise and then ask particular step if any doubt arises..I should have sent the code along with block diagram I was trying to complete..thank you sir

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by