profile_line

Jaime Lopez Carvajal jalopcar at gmail.com
Fri Apr 15 08:33:57 EDT 2016


Hi Juan,

Yeah, that is what I needed, no interpolation, so I will set it to 0.

Thanks, Jaime

On Friday, April 15, 2016 at 1:14:22 AM UTC-4, Juan Nunez-Iglesias wrote:
>
> Hey Jaime,
>
> Yes, if you set the interpolation order equal to 0, that resolves to 
> nearest neighbor interpolation, so it will pick the value from the nearest 
> pixel. The coordinates will still be fractional so that distances are 
> preserved, though. I hope that's still useful to you! =)
>
> Juan.
>
> On Fri, Apr 15, 2016 at 9:43 AM, Jaime Lopez Carvajal <jalo... at gmail.com 
> <javascript:>> wrote:
>
>> Hi Juan,
>>
>> Thanks, now I understand how it works.
>> Do you know how can I get the gray values without interpolation, just the 
>> raw gray values taken from original image?
>>
>> Thanks in advance, Jaime
>>
>> On Thursday, April 14, 2016 at 6:41:43 PM UTC-4, Juan Nunez-Iglesias 
>> wrote:
>>>
>>> No, those aren't the correct coordinates. ;)
>>>
>>> profile_line ensures that the coordinates are spaced 1 pixel apart, and 
>>> then performs interpolation (the "order" argument to the function) to find 
>>> the values.
>>>
>>> On Fri, Apr 15, 2016 at 1:54 AM, Jaime Lopez Carvajal <jalo... at gmail.com
>>> > wrote:
>>>
>>>> Sorry, the correct coordinates are:
>>>> coords = np.array([[0, 0],
>>>>
>>>>        [0, 0],
>>>>        [1, 1],
>>>>        [1, 2],
>>>>        [2, 3],
>>>>        [2, 3],
>>>>        [3, 4],
>>>>        [4, 5],
>>>>        [4, 6],
>>>>        [5, 6],
>>>>        [5, 7],
>>>>        [6, 8],
>>>>        [7, 9]])
>>>>
>>>>
>>>> On Thursday, April 14, 2016 at 11:42:01 AM UTC-4, Jaime Lopez Carvajal 
>>>> wrote:
>>>>>
>>>>> HI friends,
>>>>>
>>>>> I am having problems with *profile_line function*, because I want to 
>>>>> get gray values following some coordinates, but it is given to me wrong 
>>>>> gray values
>>>>> that does not exist in the original image, like 128, 126 or 64.
>>>>>
>>>>> image = np.array([[170, 170,  70,  70,  70,  70,  70,  70,  70,  70],
>>>>>        [170, 170,  70,  70,  70,  70,  70,  70,  90,  70],
>>>>>        [170, 170, 170,  70,  70,  70,  70,  70,  70,  70],
>>>>>        [170, 170, 170,  70,  70,  70,  70,  70,  70,  70],
>>>>>        [170, 170, 170,  70,  70,  70,  70,  70,  70,  70],
>>>>>        [170, 170, 170, 170,  70,  70,  70,  70,  70,  70],
>>>>>        [110, 170, 170, 170,  70,  70,  70,  70,  70,  70],
>>>>>        [ 50, 170, 170, 170,  70,  70,  70,  70,  70,  10],
>>>>>        [ 50,  50, 170, 170,  70,  70,  70,  70,  10,  10],
>>>>>        [ 50, 110, 110, 110,  70,  70,  70,  70,  10,  10]], dtype=uint8)
>>>>>
>>>>>
>>>>> coords = np.array([[70,  0],
>>>>>
>>>>>        [70,  0],
>>>>>        [71,  1],
>>>>>        [71,  2],
>>>>>        [72,  3],
>>>>>        [72,  4],
>>>>>        [73,  4],
>>>>>        [74,  5],
>>>>>        [74,  6],
>>>>>        [75,  7],
>>>>>        [75,  8],
>>>>>        [76,  8],
>>>>>        [77,  9]])
>>>>>
>>>>>
>>>>> gray_values = profile_line(image,(0,0),(7,9)).astype(int)
>>>>>
>>>>> gray_values
>>>>>
>>>>> array([170, 170, 128, 126,  70,  70,  70,  70,  70,  70,  70,  64,  10])
>>>>>
>>>>>
>>>>> but the correct values would be:
>>>>>
>>>>> gray_values
>>>>>
>>>>> array([170, 170, 170, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70])
>>>>>
>>>>>
>>>>> Do you know why this is happening? Any suggestion?
>>>>>
>>>>>
>>>>> Thanks in advance, Jaime
>>>>>
>>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "scikit-image" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to scikit-image... at googlegroups.com.
>>>> To post to this group, send email to scikit... at googlegroups.com.
>>>> To view this discussion on the web, visit 
>>>> https://groups.google.com/d/msgid/scikit-image/28bd27cf-0761-4f73-89f9-61db6668e90f%40googlegroups.com 
>>>> <https://groups.google.com/d/msgid/scikit-image/28bd27cf-0761-4f73-89f9-61db6668e90f%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "scikit-image" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to scikit-image... at googlegroups.com <javascript:>.
>> To post to this group, send email to scikit... at googlegroups.com 
>> <javascript:>.
>> To view this discussion on the web, visit 
>> https://groups.google.com/d/msgid/scikit-image/e9e7fcae-270b-44cf-8f48-e80964d8c84e%40googlegroups.com 
>> <https://groups.google.com/d/msgid/scikit-image/e9e7fcae-270b-44cf-8f48-e80964d8c84e%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20160415/9b4def17/attachment.html>


More information about the scikit-image mailing list