how to modify read function of imageDataStore in MATLAB to read Large Images block wise?
4 views (last 30 days)
Show older comments
Suvidha Tripathi on 23 Aug 2018
Answered: Saumya Goel on 10 Sep 2018
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).
I am getting this error :
Error: Function definition not supported in this context. Create functions in code file
Then I modified again like this :
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?
Saumya Goel on 10 Sep 2018
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:
Find more on Blocked Images in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!