how to modify read function of imageDataStore in MATLAB to read Large Images block wise?

5 ビュー (過去 30 日間)
Suvidha Tripathi
Suvidha Tripathi 2018 年 8 月 23 日
回答済み: Saumya Goel 2018 年 9 月 10 日
I have very large RGB images of size as high as 20000 x 18000 pixels. I want to fit in the whole image for SEGNET training rather than breaking the image into blocks. I would loose global structure of the pattern if I train the image as blocks. Therefore, I tried to use blockproc function in MATLAB to read my image from imageDataStore funtion and process it blockwise yet together (since blockproc will consider it as one whole image).
function blockwise(bs)
I am getting this error :
function blockwise(bs)
Error: Function definition not supported in this context. Create functions in code file
Then I modified again like this :
function blockwise(bs)
to which I am receiving this error :
BLOCKPROC encountered an error while evaluating the user-supplied function handle, FUN.
The cause of the error was:
Undefined function 'blockwise' for input arguments of type 'struct'.
Error in blockprocFunDispatcher (line 13)
output_block = fun(block_struct);
Error in blockprocInMemory (line 80)
[ul_output fun_nargout] = blockprocFunDispatcher(fun,block_struct,...
Error in blockproc (line 243)
result_image = blockprocInMemory(source,fun,options);
I want to know if it is even possible to read images in datastore blockwise using blockproc and, if it is, then how should I proceed?
  2 件のコメント
Saumya Goel
Saumya Goel 2018 年 9 月 4 日
I would like to know, what is the exact issue that you are facing if you pass it as a single image, rather than trying to break it into blocks or using blockproc. Also, is it going to impact if you resize the image which would help you to retain global structure but will lead to compression of the image. If you would like to try resize option, you can have a look at this link .
Suvidha Tripathi
Suvidha Tripathi 2018 年 9 月 4 日
image is too big to pass, I get an out of memory error if i try to pass even a single image. Also, resizing is not an option since these are multi resolution images, If i resize them, I would loose lots of information.


回答 (1 件)

Saumya Goel
Saumya Goel 2018 年 9 月 10 日
As per my understanding, use of datastore is normally done in the cases where one needs to work on a collection of image files, where each individual image fits in memory, but the entire collection of images does not necessarily fit.
The issue here seems to be that the image is too large to fit into the installed RAM of the machine. One way to resolve this might be to increase the installed RAM to allow the image to fit into memory.
Apart from the above approach, these are few of the examples that might help you read large images:

Community Treasure Hunt

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

Start Hunting!

Translated by