IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

3D Python Discussion :

Probleme fichier obj plat (2D au lieu de 3D)


Sujet :

3D Python

  1. #1
    Expert éminent

    Avatar de deusyss
    Homme Profil pro
    Expert Python
    Inscrit en
    Mars 2010
    Messages
    1 659
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Expert Python
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2010
    Messages : 1 659
    Points : 8 442
    Points
    8 442
    Par défaut Probleme fichier obj plat (2D au lieu de 3D)
    Bonjour à tous,

    Apres m'etre acharné durant 2 jours sur ce probleme, je sollicite votre aide.

    Voilà, dans le cadre d'un petit projet perso, je génère un fichier obj. Mon logiciel genere deux images, qui sont analysée, puis on recupère un tableau contenant des coordonnées xyz.

    Dans mon cas d'exemple, se rapprochant du cas reel final, l'image 2 est un miroir de l'image 1.

    SI j'analyse l'image 1, je n'ai aucun soucis, et le fichier 3D généré est correct (obj lu en 3D sans aucun soucis sous Meshlab). Par contre, quand j'analyse l'image 2, Meshlab ne lit jamais la dimension Z (hauteur).

    Et c'est là que je bloque. Il doit y avoir une raison, mais laquelle? J'ai d'abord pensé à une donnée erronnée quelque part, mais je n'ai rien trouvé en supprimant petit à petit des lignes.

    Merci pour votre aide. Je met en PJ mon code d'analyse des images, et les images
    Images attachées Images attachées   
    Fichiers attachés Fichiers attachés
    "La connaissance appartient à tout le monde" (Film Antitrust)

    Tout le nécessaire pour Python:
    *News/Accueil *Cours/tutoriels *FAQ
    *Forums *Outils dédiés *Mon espace personnel avec mes Articles, Cours et Tutoriels

  2. #2
    Expert éminent

    Avatar de deusyss
    Homme Profil pro
    Expert Python
    Inscrit en
    Mars 2010
    Messages
    1 659
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Expert Python
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2010
    Messages : 1 659
    Points : 8 442
    Points
    8 442
    Par défaut
    Je joint egalement, un exemple de fichier obj de sortie.

    Je viens de me rendre compte que quand on zoomais enormement, on toruvais bien la piece 3D au milieu. Comme le fichier obj est un assemblage de 2 fonctions differente (analyse image 1 + analyse image2), il semble que le probleme soit l'algorithme.

    Toute aide est la bienvenue
    Fichiers attachés Fichiers attachés
    "La connaissance appartient à tout le monde" (Film Antitrust)

    Tout le nécessaire pour Python:
    *News/Accueil *Cours/tutoriels *FAQ
    *Forums *Outils dédiés *Mon espace personnel avec mes Articles, Cours et Tutoriels

  3. #3
    Expert éminent

    Avatar de deusyss
    Homme Profil pro
    Expert Python
    Inscrit en
    Mars 2010
    Messages
    1 659
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Expert Python
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2010
    Messages : 1 659
    Points : 8 442
    Points
    8 442
    Par défaut
    Probleme resolu. Mon algorithme était bien erroné. Je ne tenais pas compte de la bonne reference pour mes calculs. La seconde image a comme reference la droite et non la gauche.

    Pour ceux que ça interesserai, voici le code corrigé:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    def f_compute_img_left(self, path, left_limit = 0, right_limit = 320, top_limit = 0, bottom_limit = 240, angle = 0, \
    							angle_h_vision = 60, angle_v_vision = 36,distance = 410, angle_laser = 76):
    		img = Image.open(path)
    		imgx, imgy = img.size
     
    		list_xy = []
     
    		left_limit = int((imgx * left_limit) / 320)
    		right_limit = int((imgx * right_limit) / 320)
    		top_limit = int((imgy * top_limit) / 240)
    		bottom_limit = int((imgy * bottom_limit) / 240)
     
    		for y in range(top_limit, bottom_limit):
    			for x in range(left_limit, right_limit):
    				rgb = img.getpixel((x,y))
     
    				if rgb == 255:
    					pixelh = angle_h_vision / imgx
     
    					if x >= int(imgx/2):
    						angle_plus = 180
    						tetah = (x - int(imgx/2)) * pixelh
    					else:
    						angle_plus = 0
    						tetah = (imgx/2 - x) * pixelh
     
    					#d = (L*tan(teta))/(cos60 + sin60 * tan(teta))
    					d = (distance * math.tan(math.radians(tetah))) / (math.cos(math.radians(angle_laser)) + (math.sin(math.radians(angle_laser)) * math.tan(math.radians(tetah))))
     
     
    					ten_cm = bottom_limit - imgy/2
    					pixelv = 100/ten_cm
     
     
    					ptx = d * math.cos(math.radians(angle + angle_plus))
    					pty = d *math.sin(math.radians(angle + angle_plus))
    					ptz = (imgy - y) * pixelv
     
    					list_xy.append((ptx, pty, ptz))
    					break
     
    		return list_xy
     
     
     
     
    	#===================================================#
    	#                       Init                        #
    	#===================================================#
    	def f_compute_img_right(self, path, left_limit = 0, right_limit = 320, top_limit = 0, bottom_limit = 240, angle = 0, \
    							angle_h_vision = 60, angle_v_vision = 36,distance = 410, angle_laser = 76):
    		img = Image.open(path)
    		imgx, imgy = img.size
     
    		list_xy = []
     
    		left_limit = int((imgx * left_limit) / 320)
    		right_limit = int((imgx * right_limit) / 320)
    		top_limit = int((imgy * top_limit) / 240)
    		bottom_limit = int((imgy * bottom_limit) / 240)
     
    		for y in range(top_limit, bottom_limit):
    			for x in range(right_limit-1, left_limit,-1):
    				rgb = img.getpixel((x,y))
     
    				if rgb == 255:
    					pixelh = angle_h_vision / imgx
     
    					if x < int(imgx/2):
    						angle_plus = 180
    						tetah = (imgx/2 - x) * pixelh
    					else:
    						angle_plus = 0
    						tetah = (x - imgx/2) * pixelh
     
    					#d = (L*tan(teta))/(cos60 + sin60 * tan(teta))
    					d = (distance * math.tan(math.radians(tetah))) / (math.cos(math.radians(angle_laser)) + (math.sin(math.radians(angle_laser)) * math.tan(math.radians(tetah))))
     
     
    					ten_cm = bottom_limit - imgy/2
    					pixelv = 100/ten_cm
     
     
    					ptx = d * math.cos(math.radians(angle + angle_plus))
    					pty = d *math.sin(math.radians(angle + angle_plus))
    					ptz = (imgy - y) * pixelv
     
    					list_xy.append((ptx, pty, ptz))
    					break
     
    		return list_xy
    "La connaissance appartient à tout le monde" (Film Antitrust)

    Tout le nécessaire pour Python:
    *News/Accueil *Cours/tutoriels *FAQ
    *Forums *Outils dédiés *Mon espace personnel avec mes Articles, Cours et Tutoriels

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 0
    Dernier message: 20/10/2008, 00h34
  2. Probleme Fichier OST outlook
    Par RA dans le forum Outlook Express / Windows Mail
    Réponses: 6
    Dernier message: 25/11/2005, 11h33
  3. fichier *.obj???
    Par neril dans le forum OpenGL
    Réponses: 2
    Dernier message: 13/04/2005, 10h07
  4. Réponses: 8
    Dernier message: 18/05/2004, 10h03
  5. Est-ce que les fichiers .obj sont tous les mêmes?
    Par Bubonik software dans le forum Langages de programmation
    Réponses: 2
    Dernier message: 30/12/2003, 21h04

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo