Skip to content

Commit

Permalink
Merge pull request #30 from VictorVechi/25-updates
Browse files Browse the repository at this point in the history
last updates
  • Loading branch information
Salgado2004 authored Nov 30, 2022
2 parents be1a634 + d96915d commit c0c704b
Show file tree
Hide file tree
Showing 13 changed files with 563,829 additions and 8 deletions.
13 changes: 7 additions & 6 deletions interface/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import shutil
import sys
import easygui
from unittest.main import MAIN_EXAMPLES
from PyQt6.QtWidgets import QApplication, QWidget, QPushButton, QLabel, QLineEdit, QMessageBox, QMainWindow, QInputDialog, QFileIconProvider
import utils.reconstrucao as reconstruir
app = QApplication(sys.argv)
Expand Down Expand Up @@ -99,7 +98,8 @@ def criar3d(self):
reconstruir.exec(path, name[0])
self.dialog.setText("Objeto reconstruído")
self.dialog.exec()
os.startfile(f"../obj/{name[0]}/{name[0]}.obj")
os.startfile(f"obj\{name[0]}\{name[0]}.obj")
main.show()
def janelaCriarPasta(self):
try:
main.close()
Expand All @@ -110,10 +110,11 @@ def selecionarArquivos(self):
try:
self.dialog.setText("O loop ira executar 8 vezes, para selecionar os arquivos necessários, 4 imagens e 4 pcds. Selecione o arquivo e em seguida o diretório")
self.dialog.exec()
for i in range(8):
path = easygui.fileopenbox()
path2 = easygui.diropenbox()
shutil.copy2(path, path2)
if self.dialog.accept():
for i in range(8):
path = easygui.fileopenbox()
path2 = easygui.diropenbox()
shutil.copy2(path, path2)
except:
print("me mama")
def rodar():
Expand Down
16 changes: 14 additions & 2 deletions interface/utils/mapaTextura.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,24 @@ def stackImages(scale,imgArray):
ver = hor
return ver

def reordena(n):
idx = n["ang"]
return idx

def mapping(descritores, path, name):
angulos = []
cima = []
baixo = []
print("Obtendo mapa de textura")
for i in descritores:
angle = i['img'].split(".")
angle = angle[0].split("_")
angle = angle[2]

pasta = path+"/"+i['img']
img = cv2.imread(pasta, cv2.IMREAD_COLOR)
imgCropped = img[i['y']: i['y'] + i['h'], i['x']: i['x'] + i['w']]
angulos.append(imgCropped)
angulos.append({"ang": int(angle), "img": imgCropped})
b, g, r = imgCropped[5, i['w']//2]
cima.append([r, g, b])
b, g, r = imgCropped[i['h']-1, i['w']//2]
Expand All @@ -64,7 +72,9 @@ def mapping(descritores, path, name):
corBaixo = np.zeros((512, 240, 3), np.uint8)
corBaixo[:] = b//4, g//4, r//4

map = ([angulos[0], angulos[1], angulos[2], angulos[3]], [corCima, corCima, corBaixo, corBaixo])
angulos.sort(key = reordena)
#map = ([angulos[0]["img"], angulos[1]["img"], angulos[2]["img"], angulos[3]["img"]], [corCima, corCima, corBaixo, corBaixo])
map = ([corCima, corCima, corBaixo, corBaixo], [angulos[0]["img"], angulos[1]["img"], angulos[2]["img"], angulos[3]["img"]])
stackedImages = stackImages(2,map)

newPath = f"obj/{name}/{name}_textura.png"
Expand All @@ -74,6 +84,8 @@ def mapping(descritores, path, name):
cv2.imwrite(newPath, stackedImages)
writeMTL(name)
print("!!!....")

print("!!!....")

def apply(vertices, descritores):
print("Aplicando textura na malha")
Expand Down
14 changes: 14 additions & 0 deletions obj/Moca/Moca.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Arquivo de textura MTL
# Projeto realizado pelo IFPR - Campus Pinhais
# Material Count: 1

newmtl Moca_textura
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd Moca_textura.png
Binary file added obj/Moca/Moca_textura.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions obj/banana/banana.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Arquivo de textura MTL
# Projeto realizado pelo IFPR - Campus Pinhais
# Material Count: 1

newmtl banana_textura
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd banana_textura.png
192,408 changes: 192,408 additions & 0 deletions obj/banana/banana.obj

Large diffs are not rendered by default.

Binary file added obj/banana/banana_textura.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions obj/moca2/moca2.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Arquivo de textura MTL
# Projeto realizado pelo IFPR - Campus Pinhais
# Material Count: 1

newmtl moca2_textura
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd moca2_textura.png
185,672 changes: 185,672 additions & 0 deletions obj/moca2/moca2.obj

Large diffs are not rendered by default.

Binary file added obj/moca2/moca2_textura.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions obj/newMoca/newMoca.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Arquivo de textura MTL
# Projeto realizado pelo IFPR - Campus Pinhais
# Material Count: 1

newmtl newMoca_textura
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd newMoca_textura.png
Loading

0 comments on commit c0c704b

Please sign in to comment.