GPU imadjust pagefun workaround

Hello,
I am trying to run the image processing function "imadjust" on a movie using a GPU. This function is supported on GPUs and I can get it to work on single images. However, it is not supported by pagefun and therefore I have to run a for loop over all 6000 images in the movie, which takes a very long time and defeats the purpose of using a GPU. I can't imagine this is all that rare a thing to do with these tools. Am I missing something? Is there a more efficient way of doing this or am I stuck using for loops? Here is the code I'm using:
GPUpics = gpuArray(pictures);
stretched = zeros(size(GPUpics),'gpuArray'); for k = 1:size(stretched,3) stretched(:,:,k) = imadjust(GPUpics(:,:,k)); end

댓글 수: 2

Corey Silva
Corey Silva 2017년 10월 23일
Hi Josh,
I have passed along a request for pagefun to support imadjust to our development team. It will be considered for future releases of MATLAB.
Joss Knight
Joss Knight 2017년 10월 26일
편집: Joss Knight 2017년 10월 26일
I don't really understand - you only have one GPU, correct? And as long as your images are not tiny, the GPU will be fully utilized processing each one. So there's no way to parallelize it more, and all batch processing is going to do is write your loop for you. Also, pagefun is a very specific function for batch algebraic operations in Parallel Computing Toolbox, and not a generic batch processing function. Not that your proposal isn't interesting. But the point of using the GPU is to process the many pixels of your image in a massively parallel way, not to process multiple images in batch.
If your GPU isn't fully utilized you can use a parfor loop to process your images more efficiently. If you are on Linux you should use the Multi-Process Service to get true concurrency between processes.
Failing this, I don't know the details of how imadjust is being used, but I expect there's a way you could simply reshape your data and imadjust whole chunks of the video at once as if it were a single larger image.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 GPU Computing에 대해 자세히 알아보기

질문:

2017년 10월 20일

편집:

2017년 10월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by