Thanks for your explanation.
I've changed the values to 0 as you proposed but now I get a segmentation 
fault when calling the GetPixel() method.

Le mardi 29 avril 2014 08:31:07 UTC+1, Rashad a écrit :
>
> Hi,
>
>
> On Tue, Apr 29, 2014 at 9:17 AM, OTB Florian <[email protected]<javascript:>
> > wrote:
>
>> Hi,
>>
>> 337300 and 7674920 are just the coordinates of the image origin I got 
>> with otbcli_ReadImageInfo command or by adding the line
>> std::cout << cloudDetection->GetInput()->GetOrigin() << std::endl;
>> in the code.
>>
>
> This is wrong. You are confused with image pixels and image coordinates 
> here. What you are talking about is the projected coordinates of image. 
>
> Image pixels starts with 0,0 is most image processing software. IIRC, 
> Matlab is an exception in this case. But anyway here if you are trying to 
> get the pixel for the entire image, the best thing is to use image 
> iterators which gives you efficient access to pixels.
>
> If you want to get a single pixel as you mentioned in your case. 
>
> The image pixels starts with 0,0 and end with (width-1, height-1)
>
> pixelIndex[0] = 0
> pixelIndex[1] = 0
>
>  
> And for another case if you want to get a pixel at a particular 
> coordinates 
> say you only know lat,lon -> You need to find the corresponding pixel 
> location based on the projection and use it.
>
>
>>
>> Le lundi 28 avril 2014 17:09:08 UTC+1, Rashad a écrit :
>>>
>>> Hi,
>>>
>>>
>>> On Mon, Apr 28, 2014 at 10:49 AM, OTB Florian <[email protected]> wrote:
>>>
>>>> Hi Rashad,
>>>>
>>>> Thanks for your reply.
>>>> I've tested all the examples you recommanded to me.
>>>>
>>>> I'm still working on the cloud detection example and always 
>>>> experimenting the same problem.
>>>> I've just added theses code lines after cloudDetection->SetInput(reader
>>>> ->GetOutput()); (l.157 : https://github.com/
>>>> echristophe/OTB/blob/master/Examples/FeatureExtraction/
>>>> CloudDetectionExample.cxx) :
>>>>
>>>> OutputImageType::IndexType pixelIndex;
>>>> pixelIndex[0] = 337300;
>>>> pixelIndex[1] = 7674920;
>>>> unsigned short int pixelValue;
>>>> for (int i = 0; i < 4; i++) { // cause it's a 4-band image
>>>>    pixelValue = cloudDetection->GetInput()->GetPixel(pixelIndex)[i];
>>>>    std::cout << "GetPixel[" << i << "] = " << pixelValue << std::endl;
>>>>  }
>>>>
>>>>
>>>> Then I get senseless values which are different at each execution.
>>>>
>>>>
>>>
>>> How do you find the pixelIndex in the code?
>>>
>>> pixelIndex[0] = 337300;
>>> pixelIndex[1] = 7674920;
>>>
>>> Could you please elaborate the calculation of  "337300" and "7674920" ?
>>>  
>>>
>>>> Any idea?
>>>>
>>>> Thanks in advance.
>>>>
>>>>
>>>> Le vendredi 25 avril 2014 11:11:08 UTC+1, Rashad a écrit :
>>>>>
>>>>> Hi OTB,
>>>>>
>>>>>
>>>>> On Fri, Apr 25, 2014 at 11:50 AM, OTB Florian <[email protected]>wrote:
>>>>>
>>>>>>
>>>>>> Hi all!
>>>>>>
>>>>>> I'm new at OTB and studying some examples to become familiar with the 
>>>>>> library.
>>>>>>
>>>>>>
>>>>> You might start with the first example - http://www.orfeo-toolbox.org/
>>>>> SoftwareGuide/SoftwareGuidech4.html
>>>>>  
>>>>>
>>>>>> I've tried the cloud detection example (https://github.com/echristoph
>>>>>> e/OTB/blob/master/Examples/FeatureExtraction/CloudDetecti
>>>>>> onExample.cxx) with the CloudsOnReunion.tif file and it works very 
>>>>>> well.
>>>>>> However, I'm facing some difficulties while trying to get the values 
>>>>>> of the different (4) bands of a pixel via the GetPixel() method.
>>>>>>
>>>>>
>>>>> Could you post some of your code which you tried?.
>>>>>  
>>>>>
>>>>>> I'm wondering the type returned by this method. In that case, I get 
>>>>>> an array with four values which don't mean anything (NaN or values 
>>>>>> around 
>>>>>> 1e-154).
>>>>>> Behind this trouble is the way of encoding the band intensities. Is 
>>>>>> there any function to know the type of encoding, the min and max of each 
>>>>>> band?
>>>>>>
>>>>>
>>>>> I think you must try the examples first. Sources are available here - 
>>>>> http://hg.orfeo-toolbox.org/OTB/file/fc0c18977f12/Examples/Tutorials
>>>>>
>>>>> [1] http://www.orfeo-toolbox.org/SoftwareGuide/SoftwareGuidech4.html 
>>>>>
>>>>>>  
>>>>>>
>>>>>  
>>>>>> If you could help me...
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> -- 
>>>>>> -- 
>>>>>> Check the OTB FAQ at
>>>>>> http://www.orfeo-toolbox.org/FAQ.html
>>>>>>  
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "otb-users" group.
>>>>>> To post to this group, send email to [email protected]
>>>>>>
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected]
>>>>>>
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/otb-users?hl=en
>>>>>> --- 
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "otb-users" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>> send an email to [email protected].
>>>>>>
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Regards,
>>>>>    Rashad
>>>>>  
>>>>  -- 
>>>> -- 
>>>> Check the OTB FAQ at
>>>> http://www.orfeo-toolbox.org/FAQ.html
>>>>  
>>>> You received this message because you are subscribed to the Google
>>>> Groups "otb-users" group.
>>>> To post to this group, send email to [email protected]
>>>> To unsubscribe from this group, send email to
>>>> [email protected]
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/otb-users?hl=en
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "otb-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> -- 
>>> Regards,
>>>    Rashad
>>>  
>>  -- 
>> -- 
>> Check the OTB FAQ at
>> http://www.orfeo-toolbox.org/FAQ.html
>>  
>> You received this message because you are subscribed to the Google
>> Groups "otb-users" group.
>> To post to this group, send email to [email protected]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/otb-users?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "otb-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Regards,
>    Rashad
>  

-- 
-- 
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to