OpenCV Python Tutorial For Beginners 21 - Image Pyramids with Python and OpenCV

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ธ.ค. 2024

ความคิดเห็น • 35

  • @greybandreg
    @greybandreg 5 ปีที่แล้ว +3

    finally found the good explanation for image pyramid. good job

  • @KevinskyChen
    @KevinskyChen 4 ปีที่แล้ว +1

    Best openCV tutorial!!! Keep on bro

  • @hermeticGreen
    @hermeticGreen 4 ปีที่แล้ว +2

    for I in range(6) does NOT iterate 5 times....

  • @elarbiamraoui8489
    @elarbiamraoui8489 3 ปีที่แล้ว +2

    last image is in index 6, not 5.. small inattention mistake because the array had an element before the for loop, aside from that, good work !

    • @prabhakarkumar4750
      @prabhakarkumar4750 3 ปีที่แล้ว +1

      Yes. Thank you. At least somebody noticed that. I also think that is a mistake.

  • @zoltantorok1189
    @zoltantorok1189 5 ปีที่แล้ว +2

    Hi, I've been following this playlist, and this is the first tutorial I had a problem with.
    On the line "laplacian = cv2.subtract(gp[i-1], gaussian_extended)
    " I get an error that reads:
    Traceback (most recent call last):
    File "[File Path]", line 20, in
    [code mentioned earlier]
    cv2.error: OpenCV(4.1.1) C:\projects\opencv-python\opencv\modules\core\src\arithm.cpp:663: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'cv::arithm_op'
    What should I do to fix it? It's some sort of problem with cv2.subtract, because I get good results both for gp[i-1] and gaussian_extended. With the code from your website, I get the same error.
    Thank you very much to anyone who knows what to do.

    • @muhammadilyas2232
      @muhammadilyas2232 5 ปีที่แล้ว +11

      this will solve the error
      size = (gp[i - 1].shape[1], gp[i - 1].shape[0])
      gaussian_extend = cv2.pyrUp(gp[i], dstsize=size)

    • @SangNguyen-vt8jg
      @SangNguyen-vt8jg 5 ปีที่แล้ว +3

      @@muhammadilyas2232 OMG, thank you so much, I have been going through video forth and back but I didn't find any mismatch between my code and the code in video, I was getting crazy until I saw this comment. You saved my life, mate.

    • @garethbale1008
      @garethbale1008 4 ปีที่แล้ว

      @@muhammadilyas2232 hey thank you very much!

    • @saijetti7251
      @saijetti7251 4 ปีที่แล้ว

      @Muhammad Ilyas ,can u please explain the 1 st line of code

    • @quocquoc4126
      @quocquoc4126 4 ปีที่แล้ว

      @@muhammadilyas2232 thanks you so much!!!

  • @cameronjordan897
    @cameronjordan897 5 ปีที่แล้ว +1

    Thank you for all your help

  • @jayshimpi1278
    @jayshimpi1278 3 ปีที่แล้ว +3

    you can fix the error by rectifying
    gaussian_extended = cv2.pyrUp(gp[i],dstsize = (gp[i - 1].shape[1], gp[i - 1].shape[0]))
    these parameter basically needs the size of the image,
    I guess the updated version of python gives that error.

    • @wete7641
      @wete7641 ปีที่แล้ว

      thanks bruder

    • @AdiVasuDevaRao
      @AdiVasuDevaRao 4 หลายเดือนก่อน

      thank u so much

  • @randalllionelkharkrang4047
    @randalllionelkharkrang4047 4 ปีที่แล้ว

    Why did you use a copy of the image instead of the variable containing the image ?

  • @debjanichakraborty6947
    @debjanichakraborty6947 4 ปีที่แล้ว

    cv2_imshow(str(i), layer) this line is not working in google colab.
    can anyone suggest how do I write this?

  • @Nanda-ho5eh
    @Nanda-ho5eh 4 ปีที่แล้ว

    I'm getting this error. I'have copied the same code. Can anyone please help me out?? ---AttributeError: 'NoneType' object has no attribute 'copy'

    • @elarbiamraoui8489
      @elarbiamraoui8489 3 ปีที่แล้ว

      you don't read any image, check the filename

  • @vijaykumar-yq7sf
    @vijaykumar-yq7sf 5 ปีที่แล้ว

    Excellent

  • @اسامةرائد-و8ذ
    @اسامةرائد-و8ذ 4 ปีที่แล้ว

    Please i need the project in c# language 😭😭 who can get the code for c#

  • @shashanksharmadon4295
    @shashanksharmadon4295 4 ปีที่แล้ว

    thanks bro.....

  • @mohammadadil2847
    @mohammadadil2847 5 ปีที่แล้ว

    Awesome

  • @delphinechatelain649
    @delphinechatelain649 4 ปีที่แล้ว

    Thx !!

  • @fazlarabbi7049
    @fazlarabbi7049 4 ปีที่แล้ว

    subtract error

    • @mohammadyeasin6569
      @mohammadyeasin6569 4 ปีที่แล้ว

      subtract error is held for the difference of array size .to solve this add this line o code in the for loop, before caculating the gaussian extended.code-
      size=(gp[i-1].shape[1],gp[i-1].shape[0])
      my full code is-----------
      img=cv2.imread('E:\practise\machine\datasheet for practise\img\muna.jpg')
      img=cv2.resize(img,(712,712))
      # lr1=cv2.pyrDown(img)
      # lr2=cv2.pyrDown(lr1)
      # lr3=cv2.pyrDown(lr2)
      # hr=cv2.pyrUp(lr2)
      layer=img.copy()
      gp=[layer]
      for i in range(6):
      layer=cv2.pyrDown(layer)
      gp.append(layer)
      # cv2.imshow(str(i),layer)
      layer=gp[5]
      lp=[layer]
      for i in range(5, 0, -1):
      size=(gp[i-1].shape[1],gp[i-1].shape[0])


      extended=cv2.pyrUp(gp[i],dstsize=size)
      lap=cv2.subtract(gp[i-1],extended)
      cv2.imshow(str(i),lap)
      cv2.imshow('ug',layer)
      cv2.waitKey(0)
      cv2.destroyAllWindows()
      i hope u understand

  • @snowflakes003
    @snowflakes003 4 ปีที่แล้ว

    tough code! :(