nbarba / py3DRec

3D modeling from uncalibrated images
MIT License
94 stars 29 forks source link

TypeError: unsupported operand type(s) for +: 'method' and 'method' #10

Open eyildiz-ugoe opened 2 years ago

eyildiz-ugoe commented 2 years ago

Upon executing the given command in the README.md:

python uncalibrated_rec.py --input_file=./example/features_poster.txt --show

I receive:

-------------------------------
 Uncalibrated 3D Reconstruction 

--------------------------------
Traceback (most recent call last):
  File "uncalibrated_rec.py", line 495, in <module>
    main(input_file=args.input_file, show=args.show)
  File "uncalibrated_rec.py", line 431, in main
    rec_engine = UncalibratedReconstruction(sequence.length, sequence.width, sequence.height)
  File "uncalibrated_rec.py", line 43, in __init__
    self._mm = (width + height) / 2
TypeError: unsupported operand type(s) for +: 'method' and 'method'

Any recommendations? (I use Python 3.8)

vesuvisian commented 2 years ago

There seem to be some bugs scattered in the code. Go into image_sequence.py and remove the feat_2d method and add the @property decorator to length, number_of_features, width, and height. Then, in model.py, change line 33 to self._R, self._t = self.extract_rotation_translation(val). And line 49 of model.py can be self._sequence_length=P.shape[2]. Unfortunately in that same method, there a K matrix that comes out of no where.

chaimaOues commented 2 years ago

Hello, PP=inv(K[:,:,i]).dot(P[:,:,i]); NameError: name 'K' is not defined

how can i fixe this error please?

chaimaOues commented 2 years ago

Hello, I was able to solve the problem, it is necessary in uncalibrated-rec.py in line 336 global K and after pass the variable K in line 472 recModel = RecModel(K)

and after in model.py def init(self,K): self.K = K and in line 35 self._R, self._t = self.extract_rotation_translation(val,self.K)

chaimaOues commented 2 years ago

i have this result(only two point and i used the data given with this code) Capture help please