Picture size in pixel
Moderators: Dorian (MJT support), JRL
-
- Pro Scripter
- Posts: 68
- Joined: Wed Dec 07, 2005 7:13 am
Picture size in pixel
Would anyone have a hint on how I request in MacroScheduler (or VB) the size of a picture in pixel?
-
- Pro Scripter
- Posts: 68
- Joined: Wed Dec 07, 2005 7:13 am
Re: Picture size in pixel
Yep, your snippet worked just fine. Now I am trying to enhance it.
[snippet=]Let>ImageFile=c:\test\pics2.jpg
Dialog>ImageSizeDialog
object ImageSizeDialog: TForm
object MSImage1: tMSImage
AutoSize = True
end
end
EndDialog>ImageSizeDialog
SetDialogProperty>ImageSizeDialog,MSImage1,LoadImage,Imagefile
GetDialogProperty>ImageSizeDialog,MSImage1,Width,Xpixels
GetDialogProperty>ImageSizeDialog,MSImage1,Height,Ypixels
WriteLN>test.txt,result,%xpixels%,%ypixels%[/snippet]
This gets me the pixel size. (Thanks again!!)
Now I have set up a tiny ini.file, from where I want to read permanent values for the calibration of a fixed camera.
This would convert the gained pixel sizes into cm. That for, I first of all take a picture of an object, which I measured before.
I find out, it is 100 x 100 mm, which I later would divide by the number of pixels. The final value would tell me, how many pixel make out a cm in this setting. So far for the plan ...
test.ini
[calibrate]
value1=100
value2=100
[snippet=]
ReadIniFile>C:\test\test.ini,calibrate,value1,size
Let>msg=The size is
ConCat>msg,size
Message>msg
[/snippet]
I had expected to see a message "The size is 100" - but it is "The size is ".
Any hint why I can not pick the value from the ini-file?
[snippet=]Let>ImageFile=c:\test\pics2.jpg
Dialog>ImageSizeDialog
object ImageSizeDialog: TForm
object MSImage1: tMSImage
AutoSize = True
end
end
EndDialog>ImageSizeDialog
SetDialogProperty>ImageSizeDialog,MSImage1,LoadImage,Imagefile
GetDialogProperty>ImageSizeDialog,MSImage1,Width,Xpixels
GetDialogProperty>ImageSizeDialog,MSImage1,Height,Ypixels
WriteLN>test.txt,result,%xpixels%,%ypixels%[/snippet]
This gets me the pixel size. (Thanks again!!)
Now I have set up a tiny ini.file, from where I want to read permanent values for the calibration of a fixed camera.
This would convert the gained pixel sizes into cm. That for, I first of all take a picture of an object, which I measured before.
I find out, it is 100 x 100 mm, which I later would divide by the number of pixels. The final value would tell me, how many pixel make out a cm in this setting. So far for the plan ...
test.ini
[calibrate]
value1=100
value2=100
[snippet=]
ReadIniFile>C:\test\test.ini,calibrate,value1,size
Let>msg=The size is
ConCat>msg,size
Message>msg
[/snippet]
I had expected to see a message "The size is 100" - but it is "The size is ".
Any hint why I can not pick the value from the ini-file?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Picture size in pixel
What is the value of "size" in the debugger watch list?
What do you see if you do:
MessageModal>size
Or:
MessageModal>Size is %size%
right after the ReadiniFile call.
Could any of those values already be variables. What happens if you do:
ReadIniFile>C:\test\test.ini,{"calibrate"},{"value1"},varSize
MessageModal>varSize
What do you see if you do:
MessageModal>size
Or:
MessageModal>Size is %size%
right after the ReadiniFile call.
Could any of those values already be variables. What happens if you do:
ReadIniFile>C:\test\test.ini,{"calibrate"},{"value1"},varSize
MessageModal>varSize
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Pro Scripter
- Posts: 68
- Joined: Wed Dec 07, 2005 7:13 am
Re: Picture size in pixel
The watch list shows a zero for every line. Do I have this right?What is the value of "size" in the debugger watch list?
It shows "size" or "Size is %size%"MessageModal>size
Or:
MessageModal>Size is %size%
right after the ReadiniFile call.
I have not defined any further variables and in this case the message field is empty.Could any of those values already be variables. What happens if you do:
ReadIniFile>C:\test\test.ini,{"calibrate"},{"value1"},varSize
MessageModal>varSize
Re: Picture size in pixel
Look in the ini file and make sure that the spelling is correct for the Section Name and the Entry Name. Also make sure you have a value for "value1".
Also check that the path and file name are correct and that you and Macro Scheduler have rights to open the file.
ReadIniFile> has always worked well. You're likely missing something easy
Also check that the path and file name are correct and that you and Macro Scheduler have rights to open the file.
ReadIniFile> has always worked well. You're likely missing something easy
Yes, every line in the watch list starts with 0: . I think its for future capabilities. It has no bearing on the watch list functionality.The watch list shows a zero for every line. Do I have this right?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Picture size in pixel
Actually it tells you the level of scope. If you step into a subroutine and local variables are enabled, you'll see that number increment. Each level of scope deeper, the higher that number becomes. It's really just to help in the case where you may have local variables enabled and a local variable with the same name as a variable at a higher scope. Without this numeric scope indicator you won't know which was which.Yes, every line in the watch list starts with 0: . I think its for future capabilities. It has no bearing on the watch list functionality.
Probably 99% of people will never use local variables and won't care (and may not understand what I just said). If that's you just ignore that zero
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?