Open iionichi opened 1 year ago
Hi @iionichi ,
awesome! Great to see progress here :-)
Would you mind uploading your code and the (notebook?) that produces the output shown above to a branch or fork on github? In that way, others could reproduce your experiment and potentially help.
Have a great weekend!
Best, Robert
@haesleinhuepf I have pushed the code to the repository.
I have pushed the code to the repository.
Where? Can you provide a link? Thanks!
I have pushed the code to the repository.
Where? Can you provide a link? Thanks!
Since I cannot commit in the this repository I had forked it to push the code in the affine branch : https://github.com/iionichi/pyclesperanto_prototype/tree/affine
Here is the pull request to merge the update to the affine branch of this repository : https://github.com/clEsperanto/pyclesperanto_prototype/pull/311
Just for completeness, the notebook is located there: https://github.com/clEsperanto/pyclesperanto_prototype/blob/1343678a103fa4cc4335c1b904fb93661caa41bb/pyclesperanto_prototype/_tier8/cle_test.ipynb
printing in opencl:
int i = 5;
if (x == 5 && y == 6) {
printf("%d", i);
}
In case you want to make sure that pixels outside the image are considered == 0, feel free to adapt the strategy used here: https://github.com/clEsperanto/pyclesperanto_prototype/pull/303/commits/031d524c7fb40b6a0c51ba49b3fe2867f4140994
@haesleinhuepf can you share how you showed the color beyond the edge of the image?
I have updated the code. Instead of considering pixels outside the image as zero or same as the boundary pixel I have considered pixel previous to the current pixel. With this the interpolation is very similar to the one which openCL does with hardware acceleration. The shifting problem still stays unfortunately. The updated kernel: https://github.com/iionichi/pyclesperanto_prototype/blob/affine/pyclesperanto_prototype/_tier8/affine_transform_2d_x.cl Notebook link: https://github.com/iionichi/pyclesperanto_prototype/blob/affine/pyclesperanto_prototype/_tier8/cle_test.ipynb
Context and Problem
This is code which I have extended for affine transformation to include interpolation at the software level. However the desired output is not getting generated.
Input image![image](https://github.com/clEsperanto/pyclesperanto_prototype/assets/25909457/fd315270-3e82-4e25-a05e-817df458d290)
Following is the output from the above code.![image](https://github.com/clEsperanto/pyclesperanto_prototype/assets/25909457/856d1be2-d520-4abc-ae9d-9c4f302e151a)
Following is the output from interpolation done by openCL![image](https://github.com/clEsperanto/pyclesperanto_prototype/assets/25909457/aac22ced-e9fc-436c-a388-af5d8dd5ee49)
What I would like to do
I want to debug at the kernel level to understand what is happening and how the calculations are being performed. People on the internet said to run the kernel in a debugger to closely monitor the kernel. If someone has already done it I would be happy to learn how to do it.
Something I found
In the book OpenCL in Action it says in page 137 that:![image](https://github.com/clEsperanto/pyclesperanto_prototype/assets/25909457/ab0c1254-fba0-4a8e-8772-8a5a8528ca3b)
With this I understand that OpenCL has in-built functions to deal with interpolations when it is not supported in some systems. In this case I don't think it would be necessary to add this interpolation at the kernel level.