Institute of Computer Science
  1. Main page
  2. IT koolidele
ET
Log in

IT koolidele

  • OpenCV sissejuhatus
  • OpenCV paigaldamine
  • Vajalike materjalide allalaadimine
  • Mis on pilt?
  • Pildid
  • Kaamera kasutamine
  • Pilditöötlus
  • Objektide tuvastus
  • Lisa: Panoraam

Panoraam

Eesmärk

Selles peatükis õpime, kuidas on võimalik luua mitmest pildist kokku ühe tervikliku panoraam pildi.

OpenCV pakub mitmeid võimsaid tööriistu piltide töötlemiseks, sealhulgas Stitcher klassi, mis on mõeldud piltide "õmblemiseks", et luua panoraamfotosid. Stitcher klass aitab automaatselt ühendada mitu üksteisega osaliselt kattuvat fotot üheks suureks pildiks, säilitades samal ajal visuaalse järjepidevuse ja kvaliteedi.

Pildid peavad olema tehtud samast asukohast ja sama aeg, et vältida valguse erinevust, saavutades parima tulemuse.

Alustame asjade impordiga

# Read Images

imagefiles = glob.glob(f"boat{os.sep}*")
imagefiles.sort()


images = []
for filename in imagefiles:
    img = cv2.imread(filename)
    img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    images.append(img)

num_images = len(images)

# Display Images
plt.figure(figsize=[30, 10])
num_cols = 3
num_rows = math.ceil(num_images / num_cols)
for i in range(0, num_images):
    plt.subplot(num_rows, num_cols, i + 1)
    plt.axis("off")
    plt.imshow(images[i])

Algselt on kokku 6 pilti

sticher klassi kasutamine

# Stitch Images
stitcher = cv2.Stitcher_create()
status, result = stitcher.stitch(images)

if status == 0:
    plt.figure(figsize=[30, 10])
    plt.imshow(result)

Tulemus:

Siin on järgmised pildid õpetaja maakodust, kasutades stitcher klassi, loo üks suur panoraam pilt nendest.

  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment