WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1  
Old 05-22-2012, 10:59 AM
goro goro is offline
Member
 
Join Date: May 2012
Posts: 33
Angry Marker is not getting detected in Flipped Image

I working on ARToolKit & Successfully flipped the Webcam Image. But now the issue is Marker is not getting detected in flipped texture.

Here is the code:

Code:
import viz
import vizact
import Image
viz.go()

#------------------------ Flip Horizontal ------------------------------#
def FlipHorizontal(cam_tex,texture):
	image = Image.fromstring('RGB',[width,height],cam_tex.getImageData())
	"""Copy the PIL image to the Vizard texture"""
	im = image.transpose(Image.FLIP_LEFT_RIGHT)
	RGB2BGR = (
		0.0, 0.0, 1.0, 0.0,
		0.0, 1.0, 0.0, 0.0,
		1.0, 0.0, 0.0, 0.0 )
	texture.setImageData(im.convert('RGB',RGB2BGR).tostring(),im.size)
	
#Create a blank Vizard texture
tex = viz.addBlankTexture([1,1],format=viz.TEX_BGR)

#Load Video Camera
video = viz.add('VideoCamera.dle')
# Load Web Camera & set cam as Video Texture
cam = video.addWebcam()

#Load ARToolKit
ar = viz.add('ARToolKit.dle')

width,height,type = cam.getSize()

# Flip Video Texture Horizontally
vizact.ontimer(0,FlipHorizontal,cam,tex)

# Set ARToolKit Camera with cam as texture
camera = ar.addCamera(tex)  #---- This Dosn't work
#camera = ar.addCamera(cam) #---- This works
camera.setDebug(True)

# Add AR Marker
marker = camera.addMarker('ar/patt.hiro',width = 1000.00) #patt.hiro or patt.hiro_fh 

#Add logo model
logo = viz.add('logo.ive')

#Link logo model to marker sensor
link = viz.link(marker,logo)
Reply With Quote
  #2  
Old 05-29-2012, 09:20 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You need to flip the image before ARToolkit processes the camera image. Try scheduling the FlipHorizontal function with a lower update priority using the following code, instead of using vizact.ontimer:
Code:
vizact.onupate(viz.PRIORITY_PLUGINS,FlipHorizontal,cam,tex)
Reply With Quote
Reply

Tags
artoolkit, camera, flip, flip horizontally, webcam

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
User keyboard input without halting the program Zhi Vizard 2 06-23-2011 12:53 PM
Controlling User Input ohad Vizard 1 03-15-2010 05:16 PM
How to input several model files and then save one output file mspusch Vizard 1 07-15-2008 10:30 PM
problems with webcam plug-in v-clizzin Plug-in development 2 01-25-2008 03:06 PM
problem with input boxes shai Vizard 6 08-15-2005 10:51 AM


All times are GMT -7. The time now is 10:08 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC