本文整理汇总了C++中CImgList::display方法的典型用法代码示例。如果您正苦于以下问题:C++ CImgList::display方法的具体用法?C++ CImgList::display怎么用?C++ CImgList::display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImgList
的用法示例。
在下文中一共展示了CImgList::display方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inciso3
void inciso3() {
unsigned int w = 256;
unsigned int h = 256;
CImg<double> linea_vertical = lineaVertical(w,h,w/2).get_normalize(0,255);
CImg<double> linea_horizontal = lineaHorizontal(w,h,h/2).get_normalize(0,255);
CImg<double> cuadrado = rectCentrado(w,h,w/40,h/4).get_normalize(0,255);
CImg<double> rectangulo = rectCentrado(w,h,w/2,h/10).get_normalize(0,255);
CImg<double> circulo = circuloCentrado(w,0).get_normalize(0,255);
CImgList<double> lista;
lista.assign(linea_vertical,linea_horizontal,cuadrado,rectangulo,circulo);
lista.display();
//CImgList<double> f_linea_vertical = linea_vertical.get_FFT();
//CImgList<double> f_linea_horizontal = linea_horizontal.get_FFT();
//CImgList<double> f_cuadrado = cuadrado.get_FFT();
//CImgList<double> f_rectangulo = rectangulo.get_FFT();
//CImgList<double> f_circulo = circulo.get_FFT();
CImg<double> fm_linea_vertical = magn_tdf(linea_vertical, true);
CImg<double> fm_linea_horizontal = magn_tdf(linea_horizontal, true);
CImg<double> fm_cuadrado = magn_tdf(cuadrado, true);
CImg<double> fm_rectangulo = magn_tdf(rectangulo, true);
CImg<double> fm_circulo = magn_tdf(circulo, true);
CImgList<double> lista_fft;
lista_fft.assign(fm_linea_vertical, fm_linea_horizontal, fm_cuadrado, fm_rectangulo, fm_circulo);
lista_fft.display();
}
示例2: main
int main(int argc, char *argv[]) {
//@ Leer filtro, aplicar filtro, convolve con filtro de distinta medida. Filtra segun un umbral
const char* _input = cimg_option("-i", "../images/hubble.tif", "Input Image File");
const char* _filter = cimg_option("-m", "filtro_ej3.txt", "Input filter File");
const unsigned int _lado = cimg_option("-l", 5, "Input filter File");
const unsigned int _umbral = cimg_option("-u", 150, "Input filter File");
CImg<unsigned char> img(_input), output, output_grises(img.width(), img.height(), 1 , 1 , 0),
img_binaria(img.width(), img.height(), 1 , 1 , 0);
//Creamos el filtro de promediado
utils::genArchivoMascara(_filter, _lado, _lado);
CImg<double> filtro = utils::get_filtro(_filter);
//Convolucionamos
output = img.get_convolve(filtro);
//Binarizamos la imagen a partir del umbral definido
cimg_forXY(output, x , y) {
if (output(x,y) > _umbral ) {
img_binaria(x,y) = 255;
output_grises(x,y) = img(x,y);
}
}
//Dibujamos
CImgList<double> lista;
lista.assign(img, output, img_binaria, output_grises );
lista.display();
}
示例3: main
int main( int argc, char **argv ) {
const char *filename = cimg_option( "-f",
"../../imagenes/estanbul.tif",
"ruta archivo imagen" );
int umbral = cimg_option( "-u", 127, "umbral" );
CImgDisplay disp, disp2, disp3, disp4, disp5, disp6, disp7, disp8;
CImg<double> img ( filename ), gx, gy, gxy, gyx;
img.channel(0);
img.display(disp);
gx = img.get_convolve( masks::sobel_gx() );
gy = img.get_convolve( masks::sobel_gy() );
gxy = img.get_convolve( masks::sobel_gxy() );
gyx = img.get_convolve( masks::sobel_gyx() );
CImgList<double> list ( gx, gy, gxy ,gyx );
list.display(disp3);
disp3.set_title("deteccion de bordes: sobel gx - gy - gxy - gyx");
(gx+gy+gxy+gyx).normalize(0,255).display(disp4);
disp4.set_title("deteccion de bordes: sobel gx + gy + gxy + gyx");
CImgList<double> list2 ( gx.get_normalize(0,255).get_threshold( umbral ),
gy.get_normalize(0,255).get_threshold( umbral ),
gxy.get_normalize(0,255).get_threshold( umbral ),
gyx.get_normalize(0,255).get_threshold( umbral ) );
list2.display(disp7);
disp7.set_title("sobel umbral: gx - gy - gxy - gyx");
CImgList<double> list3 ( masks::sobel_gx().resize(100,100),
masks::sobel_gy().resize(100,100),
masks::sobel_gxy().resize(100,100),
masks::sobel_gyx().resize(100,100) );
list3.display(disp8);
disp8.set_title("masks sobel: gx - gy - gxy - gyx");
while ( (!disp.is_closed() && !disp.is_keyQ()) ) {
disp.wait_all();
}
return 0;
}
示例4: main
int main(int argc, char *argv[]) {
//@ Leer filtro, aplicar filtro, convolve con filtro de distinta medida
const char* _input = cimg_option("-i", "../images/cameraman.tif", "Input Image File");
const char* _filter = cimg_option("-m", "filtro_examen_m1.txt", "Input filter File");
const char* _filter2 = cimg_option("-s", "filtro_examen_m2.txt", "Input filter File");
CImg<double> img(_input), m1, m2;
CImg<double> filtro = get_filtro(_filter);
CImg<double> filtro2 = get_filtro(_filter2);
m1 = img.get_convolve(filtro);
m2 = m1.get_convolve(filtro2);
CImgList<unsigned char> lista;
lista.assign(img, m1, m2);
lista.display();
}
示例5: inciso4
void inciso4() {
unsigned int w = 512;
unsigned int h = 512;
CImg<double> linea = lineaVertical(w,h,w/2).get_normalize(0,255);
CImg<double> rotada = linea.get_rotate(20);
CImg<double> c_linea = linea.get_crop(w/4,h/4,3*w/4, 3*h/4);
CImg<double> c_rotada = rotada.get_crop(w/4+100,h/4,3*w/4+100, 3*h/4);
CImgList<double> lista;
lista.assign(linea,rotada,c_linea,c_rotada);
lista.display();
CImg<double> fm_linea = magn_tdf(c_linea, true);
CImg<double> fm_rotada = magn_tdf(c_rotada, true);
CImgList<double> lista_fft;
lista_fft.assign(fm_linea, fm_rotada);
lista_fft.display();
}
示例6: main
int main(int argc, char *argv[]) {
if ( !argv[1] ){
printf( "%s: Convoluciona la imagen con un kernel de 3x3.\n", argv[0] );
printf( "uso: %s <archivo_imagen>\n", argv[0] );
return 1;
}
CImg<double> kernel ( 3,3,1,1,1);
kernel(0,0)=0; kernel(1,0)=1; kernel(2,0)=2;
kernel(0,1)=1; kernel(1,1)=2; kernel(2,1)=1;
kernel(0,2)=2; kernel(1,2)=1; kernel(2,2)=0;
CImg<double> imagen( argv[1] );
CImgList<double> result ( imagen.get_normalize(0,255),
kernel.get_normalize(0,255),
imagen.get_convolve( kernel ).get_normalize(0,255) );
result.display();
return 0;
}
示例7: main
// Main procedure
//----------------
int main (int argc, char **argv) {
cimg_usage("Compute the skeleton of a shape, using Hamilton-Jacobi equations");
// Read command line arguments
cimg_help("Input/Output options\n"
"--------------------");
const char* file_i = cimg_option("-i",cimg_imagepath "milla.bmp","Input (black&white) image");
const int median = cimg_option("-median",0,"Apply median filter");
const bool invert = cimg_option("-inv",false,"Invert image values");
const char* file_o = cimg_option("-o",(char*)0,"Output skeleton image");
const bool display = cimg_option("-visu",true,"Display results");
cimg_help("Skeleton computation parameters\n"
"-------------------------------");
const float thresh = cimg_option("-t",-0.3f,"Threshold");
const bool curve = cimg_option("-curve",false,"Create medial curve");
cimg_help("Torsello correction parameters\n"
"------------------------------");
const bool correction = cimg_option("-corr",false,"Torsello correction");
const float dlt1 = 2;
const float dlt2 = cimg_option("-dlt",1.0f,"Discrete step");
// Load the image (forcing it to be scalar with 2 values { 0,1 }).
CImg<unsigned int> image0(file_i), image = image0.get_norm().quantize(2).normalize(0.0f,1.0f);
if (median) image.blur_median(median);
if (invert) (image-=1)*=-1;
if (display) (image0.get_normalize(0,255),image.get_normalize(0,255)).display("Input image - Binary image");
// Compute distance map.
CImgList<float> visu;
CImg<float> distance = image.get_distance(0);
if (display) visu.insert(distance);
// Compute the gradient of the distance function, and the flux (divergence) of the gradient field.
const CImgList<float> grad = distance.get_gradient("xyz");
CImg<float> flux = image.get_flux(grad,1,1);
if (display) visu.insert(flux);
// Use the Torsello correction of the flux if necessary.
if (correction) {
CImg<float>
logdensity = image.get_logdensity(distance,grad,flux,dlt1),
nflux = image.get_corrected_flux(logdensity,grad,flux,dlt2);
if (display) visu.insert(logdensity).insert(nflux);
flux = nflux;
}
if (visu) {
cimglist_apply(visu,normalize)(0,255);
visu.display(visu.size()==2?"Distance function - Flux":"Distance function - Flux - Log-density - Corrected flux");
}
// Compute the skeleton
const CImg<unsigned int> skel = image.get_skeleton(flux,distance,curve,thresh);
if (display) {
(image0.resize(-100,-100,1,3)*=0.7f).get_shared_channel(1)|=skel*255.0;
image0.draw_image(0,0,0,0,image*255.0,0.5f).display("Image + Skeleton");
}
// Save output image if necessary.
if (file_o) skel.save(file_o);
return 0;
}
示例8: main
int main(int argc, char *argv[]) {
//@ Compara el resultado de ecualizar una imagen a partir de cada canal RGB y la intensidad de HSI
const char* _input = cimg_option("-i", "../images/futbol.jpg", "Input Image File");
//Declaramos imagenes a trabajar
CImg<double> input(_input), output(input.width(), input.height(), input.depth(), 3 , 0) ;
(input.get_RGBtoHSI().get_channel(0), input.get_RGBtoHSI().get_channel(1)).display();
CImg<double> recorte = input.get_crop(132,105,203,230);
// recorte.display();
// CImg<unsigned char> histograma_r = recorte.get_channel(0).get_histogram(256, 0, 255);
// CImg<unsigned char> histograma_g = recorte.get_channel(1).get_histogram(256, 0, 255);
// CImg<unsigned char> histograma_b = recorte.get_channel(2).get_histogram(256, 0, 255);
// histograma_r.display_graph("",3);
// histograma_g.display_graph("",3);
// histograma_b.display_graph("",3);
CImg<bool> mascara_binaria(input.width(), input.height());
CImg<double> c1 = input.get_channel(0);
CImg<double> c2 = input.get_channel(1);
CImg<double> c3 = input.get_channel(2);
cimg_forXY(input, x , y) {
if (dentro_circulo(c1(x,y), 40, 20) && //rojo
dentro_circulo(c2(x,y), 85, 10) && //verde
dentro_circulo(c3(x,y), 150, 105)) { //azul
mascara_binaria(x,y) = true;
output(x,y,0,0) = input(x,y,0,0);
output(x,y,0,1) = input(x,y,0,1);
output(x,y,0,2) = input(x,y,0,2);
} else {
mascara_binaria(x,y) = false;
}
}
// //Display!
CImgList<double> lista;
lista.assign(input, mascara_binaria.normalize(0,255) , output );
lista.display();
// CImg<double> output_RGB(_input);
// CImg<double> output_HSI(_input);
// CImg<double> filtro = get_filtro(_filtro);
// //Temporales necesarios
// CImg<double> c1, c2, c3;
// //Ecualización de la RGB
// //Obtenemos los canales
// c1 = output_RGB.get_channel(0);
// c2 = output_RGB.get_channel(1);
// c3 = output_RGB.get_channel(2);
// //Los ecualizamos
// c1.convolve(filtro);
// c2.convolve(filtro);
// c3.convolve(filtro);
// //Recomponemos la imágen
// c1.append(c2, 'c');
// c1.append(c3, 'c');
// output_RGB = c1;
// //Ecualizamos la imagen HSI
// output_HSI.RGBtoHSI();
// //Obtenemos los canales
// c1 = output_HSI.get_channel(0);
// c2 = output_HSI.get_channel(1);
// c3 = output_HSI.get_channel(2);
// //Ecualizo el canal de Intensidad solamente
// c3.convolve(filtro);
// //Recomponemos la imágen
// c1.append(c2, 'c');
// c1.append(c3, 'c');
// output_HSI = c1;
// output_HSI.HSItoRGB();
// return 0;
}
示例9: display_list
//' Display image list using CImg library
//'
//' @param imlist a list of cimg objects
//' @export
// [[Rcpp::export]]
void display_list(List imlist)
{
CImgList<double> L = sharedCImgList(imlist);
L.display();
return;
}