Skip to content

Commit a8672c4

Browse files
committedFeb 9, 2017
Pirámide de Imágenes
Generar pirámides de imágenes Gaussianas y Laplacianas.
1 parent f3e3436 commit a8672c4

File tree

5 files changed

+77
-0
lines changed

5 files changed

+77
-0
lines changed
 

‎opencv-pyramid/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cmake_minimum_required(VERSION 3.4)
2+
3+
project( Tutorial_OpenCV )
4+
5+
find_package( OpenCV 3.0.0 REQUIRED )
6+
7+
file(COPY ../data/lena.jpg DESTINATION image)
8+
9+
add_executable( ${PROJECT_NAME} source.cpp )
10+
target_link_libraries( ${PROJECT_NAME} ${OpenCV_LIBS} )

‎opencv-pyramid/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Pirámide de Imágenes
2+
3+
Generación de pirámides de imágenes con las funciones OpenCV pyrDown y pyrUp.
4+
5+
*Pirámide Gaussiana*
6+
7+
![OpenCV Pirámide Gaussiana](data/gaussiana.png "Pirámide Gaussiana")
8+
9+
*Pirámide Laplaciana*
10+
11+
![OpenCV Pirámide Laplaciana](data/laplaciana.png "Pirámide Laplaciana")
12+
13+
La documentación está disponible en [Tutor de Programación](http://acodigo.blogspot.com)

‎opencv-pyramid/data/gaussiana.png

184 KB
Loading

‎opencv-pyramid/data/laplaciana.png

510 KB
Loading

‎opencv-pyramid/source.cpp

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#include <iostream>
2+
#include <opencv2/opencv.hpp>
3+
4+
using namespace cv;
5+
using namespace std;
6+
7+
int main(int argc, char** argv )
8+
{
9+
Mat image = imread("image/lena.jpg", CV_LOAD_IMAGE_COLOR);
10+
11+
if (image.empty())
12+
{
13+
printf("No image data \n");
14+
return -1;
15+
}
16+
17+
imshow("Original Image", image);
18+
19+
//------ pyrDown --------//
20+
Mat image1 = image.clone();
21+
22+
for (size_t i = 0; i < 3; i++)
23+
{
24+
pyrDown(image1, image1);
25+
imshow(to_string(image1.size().width), image1);
26+
}
27+
28+
////------ pyrUp --------//
29+
//Mat image2 = image.clone();
30+
31+
//for (size_t i = 0; i < 3; i++)
32+
//{
33+
// pyrUp(image2, image2);
34+
// imshow(to_string(image2.size().width), image2);
35+
//}
36+
37+
////------ Laplacian --------//
38+
//Mat temp1, temp2, temp3;
39+
//image.copyTo(temp1);
40+
41+
//for (size_t i = 0; i < 4; i++)
42+
//{
43+
// pyrDown(temp1, temp2);
44+
// pyrUp(temp2, temp3, temp1.size());
45+
46+
// Mat lap = temp1 - temp3;
47+
48+
// imshow(to_string(lap.size().width), lap);
49+
// temp1 = temp2;
50+
//}
51+
52+
waitKey(0);
53+
return 0;
54+
}

0 commit comments

Comments
 (0)