how to divide a color image into multiple binary codes

1 回表示 (過去 30 日間)
saima sadiya
saima sadiya 2021 年 7 月 14 日
コメント済み: Image Analyst 2024 年 9 月 3 日
how to divide an image file in cmax number of chunks(binary codes) and distribute those chunks to multiple files in some order

回答 (2 件)

Hari
Hari 2024 年 9 月 3 日
Hi saima,
I understand that you want to divide a color image into a specified number of chunks, convert these chunks into binary code, and then save each chunk into separate files.
I assume you have a color image file and a specified number of chunks (cmax) you want to divide the image into.
  • Read the Image: Use the "imread" function to load the image into MATLAB. This function reads the image as a matrix of pixel values.
  • Determine Chunk Size: Calculate the size of each chunk based on the total number of pixels and the desired number of chunks (cmax).
  • Divide Image into Chunks: Reshape the image matrix into a vector and split it into chunks. Convert each chunk into a binary code.
  • Convert Chunks to Binary and Save: Convert each chunk into binary format and save it to a file using "fwrite".
  • Organize Files: Ensure that the files are saved in the desired order and format. You can use a loop to iterate through the chunks and save each one.
References:
Hope this helps!
  1 件のコメント
Image Analyst
Image Analyst 2024 年 9 月 3 日
In step 3 can you explain this in more detail: "Convert each chunk into a binary code"?
In Step 4 can you explain this in more detail: "Convert each chunk into binary format"?
How is that different from the sub-vector "chunk" you got from dividing the reshaped matrix into? Is it a different variable type, like not a unint8?

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


Image Analyst
Image Analyst 2024 年 9 月 3 日
Not sure what you mean by binary codes. Please explain. How is that different than just a simple tile of the image you extracted from the RGB image variable, in other words a 3-D uint8 matrix?
If you just want to chop the image up into tiles you can use indexing in a loop, and then use imwrite for each subimage. Or you can use blockproc.

カテゴリ

Help Center および File ExchangeImages についてさらに検索

製品


リリース

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by