-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
addPairwiseBilateral for densecrf2d in densecrf.pyx file #59
Comments
In C, array's don't have any shape, they are just a contiguous "line" of memory. What is important is that the access to that buffer are consistent on both the NumPy and the C side. In this case, they are, since the C code is accessing the memory as [(y*W+x)*3+c], which is consistent with the memory layout NumPy gives to a If you want to learn more, I recommend you read about memory layout, especially this part of the NumPy documentation. And maybe the NumPy ndarray paper helps, too. I'm closing the issue as you're not reporting a bug, but feel free to ask more and, if you do find a bug, re-open the issue. |
Hey, thanks for the reply. Can you please if possible explain to me these 2
notations in the context of the cpp code and why you are using this :
unsigned char[:,:,::1] rgbim in
def addPairwiseBilateral(self, sxy, srgb, unsigned char[:,:,::1] rgbim
not None, compat, KernelType kernel=DIAG_KERNEL, NormalizationType
normalization=NORMALIZE_SYMMETRIC):
and
rgbim[0,0,0] in
sxy[0], sxy[1], srgb[0], srgb[1], srgb[2], &rgbim[0,0,0],
_labelcomp(compat), kernel, normalization
Regards,
Abhisek
…On Sat 31 Mar, 2018, 10:40 AM Lucas Beyer, ***@***.***> wrote:
Closed #59 <#59>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#59 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Acm2uco5aeDL3IdrgLVC7iZ4UZWIU95Wks5tj5V3gaJpZM4TCdYK>
.
|
Both of these are explained in the Cython User Guide, chapter about Typed Memoryviews, you should read that if you're interested. Briefly, the first one means it's a 3D array that is C-contiguous in layout; if a non-C-contiguous array is passed, it will raise an exception. The second one, |
Hello,
Thank you so much for your reply. I really appreciate you taking your time
to reply. I will look into the guides.
Thanks,
Abhisek
…On Sat, Mar 31, 2018 at 1:02 PM, Lucas Beyer ***@***.***> wrote:
Both of these are explained in the Cython User Guide, chapter about Typed
Memoryviews
<http://cython.readthedocs.io/en/latest/src/userguide/memoryviews.html>,
you should read that if you're interested.
Briefly, the first one means it's a 3D array that is C-contiguous in
layout; if a non-C-contiguous array is passed, it will raise an exception.
The second one, &rgbim[0,0,0] (you forgot the & which is important) is a
pointer to the start of the buffer.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#59 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Acm2udmLfSx9ROQX3sMHcLlY4452bBE0ks5tj7a2gaJpZM4TCdYK>
.
|
Hey, I was going through the original cpp code for the addPairwiseBilateral for denseCRF2D and there the array they pass, im, seem to be of the dimension [(w_*h_*3), 1], but in the .pyx file it checks for the size of the im array to be of [w_ , h_ , 3]. Can someone please explain to me this part? Sorry, I am kind of new to this. So, having an issue understanding how the stuff actually works.
Thanks,
The text was updated successfully, but these errors were encountered: