Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 29 Aug 2014, 20:26
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Graphics
3D-Pic
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Mon 11 Jun 2012, 17:08    Post subject:  3D-Pic
Subject description: create stereoscopic 3D Fotos for 3D-TVs with your webcam
 

This is a small commandlineprogram written in C using the GDK library.

If you have a 3D Television or Monitor like the LG Cinema 3D models, this might be nice for you.

You can use your webcam with a program like "ucview" (search forum) to create a foto.
Then slide the webcam some cm aside, and take another foto.

So you usually now have something like
/root/Image_00000.jpg
/root/Image_00001.jpg

To convert them to a 3D Foto, type in a consolewindow:
Code:
cd /root
3dpic Image_00000.jpg Image_00001.jpg out.jpg


The resulting "out.jpg" has merged both in one file, side by side, scaled down to the half width.

As the program is jus a quick hack, it has no further options.
The resulting picture has HDTV resolution (1920x1080).The Jpeg Quality is 100, to avoid loosing quality.

To view the picture in 3D, use your favorite Pictureviewer like gqview, press "f" to see it fullscreen.
Then on LG Monitors, press the "3D" button on the remote control, and use the 3D-Mode "2 pictures side by side".

Enjoy!

I attach a test jpeg I just created.

More fotos will be added here:

http://noforum.de/pics/3dpics/


Note: the program was compiled in Fluppy 013.
If it does not work on other puppys, you can recompile it like this:
Code:
cd /usr/local/3dpic/source
./install

This requires to have a "devx" development SFS for your Puppy installed.

Mark
out.jpg
Description 
jpg

 Download 
Filename  out.jpg 
Filesize  1.12 MB 
Downloaded  364 Time(s) 
3dpic.pet
Description  License: GPL V3 (not included)
pet

 Download 
Filename  3dpic.pet 
Filesize  3.21 KB 
Downloaded  319 Time(s) 

_________________
my recommended links

Last edited by MU on Sat 23 Jun 2012, 19:01; edited 3 times in total
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Mon 11 Jun 2012, 18:50    Post subject:  

Here is another example, now with close objects.
You will see with the unsharp "Asus" logo on the top right, that positioning of the camera is critical.

I think I will build a mechanical "slider" for it this week to avoid, that the cam moves up or down when moving it.

Still impressioning though on a 3Dmonitor, will be nice to fotograph some model spaceships somewhen this week Smile

Mark
out3.jpg
Description 
jpg

 Download 
Filename  out3.jpg 
Filesize  1.24 MB 
Downloaded  328 Time(s) 

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Tue 12 Jun 2012, 09:30    Post subject:  

Dear Mark,

Glad to see you back here. Smile

With kind regards,
vovchik
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Tue 12 Jun 2012, 09:49    Post subject:  

Hello Vovchik,

Thank you Smile
I just have time to look in temporarily, as I work fulltime on Computers.
So after work I am often fed up with them, and do not program any more in my spare time.

However if there are smaller tools I write to simplify the usage of my main operating system (Fluppy013 actually), I of course share them here Smile

Cheers, Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11029
Location: Arizona USA

PostPosted: Tue 12 Jun 2012, 10:26    Post subject:  

Yes Mark, it's good to see that you haven't quit the forum altogether. Smile

Depending on the effect you're after in the 3-D picture, you might want everything in the picture to be in focus. I don't know what the depth of field of a webcam is, and I don't think you have any control over it. If you take the pictures with a camera that allows you to fiddle with the lens aperture, shutter speed and ASA or iso speed, you can set the lens aperture to its smallest opening (highest number on the dial) to get the greatest depth of field and bring more of the picture into sharp focus. Pinhole cameras have almost infinite depth of field. A 3-D camera made with pinhole "lenses" would be an interesting thing to try. Everything in the picture would be in sharp focus. Well, more or less; pinhole images aren't quite as sharp as those made with a regular lens.
Back to top
View user's profile Send private message 
Ted Dog


Joined: 13 Sep 2005
Posts: 2314
Location: Heart of Texas

PostPosted: Tue 12 Jun 2012, 11:30    Post subject:  

Can this be used for DIY cross your eyes old school 3D?
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Wed 13 Jun 2012, 18:11    Post subject:  

Ted Dog wrote:
Can this be used for DIY cross your eyes old school 3D?


Hi Ted, yes almost.
For "cross your eyes" you need both images in the original aspect ratio, while 3D Monitors need them scaled to half width.

Here are examples of your method:
http://wolfatmidnight.blogspot.de/2012/05/3d-illusions-slightly-cross-your-eyes.html

The sourcecode of my program had to be slightlly modified for this.
It had to load a black jpg first (as background), and then place the 2 fotos on that, scaled down in width and (new) in height, too.

Maybe I can upload a corresponding version tomorrow.


-------------------------------------------
I made more 3D tests. If you have TWO cameras, you also could watch their stream in 3D.

Such a script will do it:

Code:
#!/bin/bash

#-- LEFT cam

mplayer tv:// -tv driver=v4l2:width=1280:height=720:device=/dev/video0:outfmt=uyvy -vf scale=960:1080 -zoom -x 960 -y 1080 -geometry 0:0 &


#-- RIGHT cam

mplayer tv:// -tv driver=v4l2:width=1280:height=720:device=/dev/video1:outfmt=uyvy -vf scale=960:1080 -zoom -x 960 -y 1080 -geometry 960:0 &


The "outfmt=uyvy" avoids that an error comes up with the second cam:
Quote:
v4l2: ioctl streamon failed: No space left on device
v4l2: ioctl set mute failed: Invalid argument


Instead of yuyv you also can try mjpeg or YUY2.

The camera resolution is set to "1280:height=720", as on my Athlon 5050 (2 cores, 2.6 Mhz) the framerate is too low with higher resolution.
On faster systems you might try "1920:height=1080" instead.


I actually use 2 different cams, a Logitech C910 HDTV cam and an old Logitech model with pretty low resolution.

So I just experiment, if and how using 2 cams technically works. To watch the real 3D picture in usable quality, I will order another C910.

A generally interesting program for 3D purposes is "bino", see here:
http://www.murga-linux.com/puppy/viewtopic.php?t=76501


FLASH,
yes a real camera certainly would achieve even better results. I dream of a camcorder from panasonic, that has a special optional 3D lens. But the camcorder costs around 400 Euro, and the lens 460 Euro or so.
So I actually prefer to pay 80 Euro for a second HDTV cam right now. And the C910 has really great results, the fotos in the first message were made with it.

So the camcorder will wait, until I have earned some more bucks in my new job Smile

Cheers, Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Sat 23 Jun 2012, 18:10    Post subject:  

I attach a pet "3dsnapshot". It contains two usefull scripts.

My setup: two Logitech C910 HDTV webcams, pasted with some glue on a base (a piece of plastic).

I tried several types of glue, and ended up with 2 component epoxy glue, still experimenting.

The scripts:
Code:
/root/3dmplayer


This will run 2 windows of mplayer (see forum for download) side by side, displaying /dev/video0 and /dev/video1 (the 2 cams).
When I used a USB-Hub, it did not work, had to attach one cam on the front of the computer, the other one on the back. I think there was a conflict because both use the same address/identifier.

So like this you can see the livestream of the cameras in 3D.
To close them, press "q" in each of them.

It is written for HDTV resolution, if you have a different resolution, you need to edit /root/3dmplayer1 and /root/3dmplayer2


Options:
Code:
/root/3dmplayer low


This will use the lower "1280x720" mode of the cameras, like this they have better framerates, but worse quality.


The second script is
Code:
/root/3dsnapshot


It will send both already running mplayers the command to save screenshots, and then converts them with 3dpic2, a slightly modified 3dpic from the first message.

The resulting files are stored in /root/3dsnapshots.

The modification does not use scaling to avoid as much conversion as possible for quality reasons, so requires that the pictures are in HDTV format already.
If you use a different format, edit /root/3dsnapshot to use the original 3dpic instead of 3dpic2.

The script then simply will take the two mplayer screenshots, and combine them to a side-by-side 3D-Foto for 3D-Monitors, and then display them in gqview.
If you have a different viewer, you must edit the script to use that instead. After a keypress in the console gqview is terminated (I prefer that to some mouseclicks in gqview itself).


I run 3dsnapshot on a consolewindow on second monitor (my TV), while monitor 1 displays the cameras.
If you use just one monitor, remember that you can quickly switch the windows with "alt - tab", at least using Icewm.

Mark
3dsnapshot.pet
Description 
pet

 Download 
Filename  3dsnapshot.pet 
Filesize  5.89 KB 
Downloaded  247 Time(s) 

_________________
my recommended links

Last edited by MU on Sun 29 Jul 2012, 10:52; edited 3 times in total
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Sun 24 Jun 2012, 09:13    Post subject:  

I updated 3dsnapshot.pet

new options:

Code:
/root/3dmplayer quit


this simply closes the 2 running mplayers.

Code:
/root/3dmplayer zoom


this sets the camera to a high resolution of 2592x1944, and then "cuts out" the HDTV resolution 1920x1080.
Like this you get a "zoom". The framerate is set to 1 fps, with higher values I got blackouts.

Code:
/root/3dmplayer zoom1


Like zoom, but the cut out area now is just 1280x720, scaled up to HDTV size. So you have a "slight digital zoom" with a little quality loss.

Code:
/root/3dmplayer zoom2


Like zoom2, but the cut out area now is just 960x540, scaled up to the double HDTV size. So you have a "double digital zoom" with high quality loss.

I uploaded 4 "zoom" jpegs to http://noforum.de/pics/3dpics/
so that you can see the difference.

Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Sun 29 Jul 2012, 10:58    Post subject:  

updated 3dsnapshot

new options for /root/3dmplayer:

Code:
/root/3dmplayer offset=100:10


Parallax control, move one picture aside/down to adjust the cams if they are not aligned correctly.

Code:
/root/3dmplayer offset2=100:10


Parallax control, move one picture aside/down (different method, with zoom)

Code:
/root/3dmplayer fps=1


Set framerate to 1, use this if your system has timeouts displaying green screens.

Code:
/root/3dmplayer help


show all options

Code:
/root/3dmplayer left=video2 right=video3


Forces to use other devices than the defaults /dev/video0 and /dev/video1

I also updated /root/3dsnapshot, it grabs more reliable now and stores all files in the folder /root/3dsnapshots.

Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Graphics
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0899s ][ Queries: 12 (0.0039s) ][ GZIP on ]