|
|
Rank: Administration Groups: Administration
, Member
Joined: 4/3/2008 Posts: 105 Location: Herrliberg/Switzerland
|
For your convenience, we post here an example how to use the new cam2 module (mShell Rel. 3.05), especially the auto focus and how to find the scale for the view finder. Code:/* Simple test of Cam2 module with focusing. */ use cam2, graph as g, ui, audio
// take an image to "file" function take(file) if cam2.focus(null)=0 then // focus not supported: directly take image audio.beep(880, 200); cam2.take(file) else // start focusing cam2.focus(true); // wait 2 seconds until focusing completes if cam2.focus(2000) then audio.beep(1760, 100); cam2.take(file) else audio.beep(440, 800) end end end
// turn camera on and obtain image size s=cam2.on(); // show the graphics screen and obtain its size g.show(); gs=g.size(); // compute scale such that preview fits for scale in [1, 0.5, 0.25, 0.125] do vs=[scale*s[0], scale*s[1]]; dx=gs[0]-vs[0]; dy=gs[1]-vs[1]; if dx>=0 and dy>=0 then break end end; // show centered, scaled preview x=dx/2; y=dy/2; vs=cam2.view(x, y, scale); // enable the pointer ui.ptr(ui.relative); ui.keys(ui.strokes); clicked=false; nr=0; while true do // wait for pointer event cmd=ui.cmd(); if isarray(cmd) then if cmd[2]&1#0 then if not clicked then // if clicked into the view finder, take an image if cmd[0]>=x and cmd[0]<x+vs[0] and cmd[1]>=y and cmd[1]<y+vs[1] then nr++; take("Cam2Test-" + nr + ".jpg") end; clicked=true end else clicked=false end elsif cmd=ui.gokey then nr++; take("Cam2Test-" + nr + ".jpg") end end; g.hide(); cam2.off() File Attachment(s):
Cam2Test.m (2kb) downloaded 36 time(s).
|
|
Rank: Advanced Member Groups: Member
Joined: 1/20/2009 Posts: 38 Location: Turkey
|
Thanks Juerg. "Benim kudretimin ulaştığı yere,sizin hayalleriniz bile ulaşamaz." Fatih Sultan Mehmet Han.
|
|
Rank: Member Groups: Member
Joined: 9/7/2009 Posts: 21 Location: Hamburg, Germany
|
Doesn't work here. He cant find cam2, but i already installed the newest version. Where can cam2 be found?
thanks!
|
|
Rank: Newbie Groups: Member
Joined: 7/9/2009 Posts: 4 Location: Hong kong
|
Hi Foolx,
Are you already install camerawrapper.sisx? The "airbit" source code work fine on my nokia 5800.
Awolswat
|
|
Rank: Member Groups: Member
Joined: 9/7/2009 Posts: 21 Location: Hamburg, Germany
|
ok, all is working now ;) My fault ;)
|
|
Rank: Advanced Member Groups: Member
Joined: 6/16/2007 Posts: 187 Location: Ukraine
|
hm... i didn't understood, is there are way to disable autofocus? to take pics as is? for ex start focusing if focuses earlier that (x)seconds - take picture with focus if no - take as is... huh? :) http://djdonatas.com
|
|
Rank: Newbie Groups: Member
Joined: 7/9/2009 Posts: 4 Location: Hong kong
|
Dear airbit,
Do you have a Video Recording example? I want to make a program to take 640x480 30fps on my nokia 5800. But, It always show error. Could you mind give me some suggestion? Thanks a lot.
Awolswat
use video,cam2,video,ui,time,proc,app,vibra,files,audio,cam;
cam.on(-1, true);
rIndex=0; fIndex=0; for r=0 to len(video.recorders)-1 do formats=video.recorders[r]["formats"]; for f=0 to len(formats)-1 do if index(formats[f]["name"], "MPEG-4")>=0 then rIndex=r; fIndex=f end end end;
// create t=video.create("MyVideo.mp4", rIndex, fIndex);
video.setup();
video.record();
sleep(10000); video.stop(); video.close();
cam.off()
|
|
Rank: Advanced Member Groups: Member
Joined: 10/1/2008 Posts: 38 Location: Italy
|
hi bro!
How do I force the use of flash??
|
|
Rank: Advanced Member Groups: Member
Joined: 6/3/2009 Posts: 37 Location: Italy
|
Hi, where could I find camerawrapper.sisx? ρѕρ & gт-ι8910 н∂ нα¢кє∂
|
|
Rank: Member Groups: Member
Joined: 7/24/2009 Posts: 14 Location: TURKEY
|
thanx for works
|
|
Rank: Newbie Groups: Member
Joined: 12/27/2008 Posts: 2 Location: Russia
|
and what about UIQ3 phones? standart video settings/
|
|
Rank: Administration Groups: Administration
, Member
Joined: 4/3/2008 Posts: 105 Location: Herrliberg/Switzerland
|
Since there is no camera wrapper module available for UIQ3, m module cam2 is not available on that platform. Use module cam instead.
|
|
|
Guest |