当前位置: 首页>>代码示例>>C++>>正文


C++ show_image函数代码示例

本文整理汇总了C++中show_image函数的典型用法代码示例。如果您正苦于以下问题:C++ show_image函数的具体用法?C++ show_image怎么用?C++ show_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了show_image函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onDraw

    void onDraw(SkCanvas* canvas) override {
        sk_sp<SkImage> image0(make_image(canvas));

        const ImageFilterFactory factories[] = {
            IFCCast([]{ return SkBlurImageFilter::Make(8, 8, nullptr); }),
            IFCCast([]{ return SkDilateImageFilter::Make(8, 8, nullptr); }),
            IFCCast([]{ return SkErodeImageFilter::Make(8, 8, nullptr); }),
            IFCCast([]{ return SkOffsetImageFilter::Make(8, 8, nullptr); }),
        };

        const SkMatrix matrices[] = {
            SkMatrix::MakeScale(SK_ScalarHalf, SK_ScalarHalf),
            SkMatrix::MakeScale(2, 2),
            SkMatrix::MakeTrans(10, 10)
        };

        const SkScalar spacer = image0->width() * 3.0f / 2;

        canvas->translate(40, 40);
        for (auto&& factory : factories) {
            sk_sp<SkImageFilter> filter(factory());

            canvas->save();
            show_image(canvas, image0.get(), filter);
            for (const auto& matrix : matrices) {
                sk_sp<SkImageFilter> localFilter(filter->makeWithLocalMatrix(matrix));
                canvas->translate(spacer, 0);
                show_image(canvas, image0.get(), std::move(localFilter));
            }
            canvas->restore();
            canvas->translate(0, spacer);
        }
    }
开发者ID:03050903,项目名称:skia,代码行数:33,代码来源:localmatriximagefilter.cpp

示例2: test_lsd

void test_lsd(char *cfgfile, char *weightfile, char *filename)
{
    network net = parse_network_cfg(cfgfile);
    if(weightfile){
        load_weights(&net, weightfile);
    }
    set_batch_network(&net, 1);
    srand(2222222);

    clock_t time;
    char buff[256];
    char *input = buff;
    int i, imlayer = 0;

    for (i = 0; i < net.n; ++i) {
        if (net.layers[i].out_c == 3) {
            imlayer = i;
            printf("%d\n", i);
            break;
        }
    }

    while(1){
        if(filename){
            strncpy(input, filename, 256);
        }else{
            printf("Enter Image Path: ");
            fflush(stdout);
            input = fgets(input, 256, stdin);
            if(!input) return;
            strtok(input, "\n");
        }
        image im = load_image_color(input, 0, 0);
        image resized = resize_min(im, net.w);
        image crop = crop_image(resized, (resized.w - net.w)/2, (resized.h - net.h)/2, net.w, net.h);
        //grayscale_image_3c(crop);

        float *X = crop.data;
        time=clock();
        network_predict(net, X);
        image out = get_network_image_layer(net, imlayer);
        //yuv_to_rgb(out);
        constrain_image(out);
        printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
        show_image(out, "out");
        show_image(crop, "crop");
        save_image(out, "out");
#ifdef OPENCV
        cvWaitKey(0);
#endif

        free_image(im);
        free_image(resized);
        free_image(crop);
        if (filename) break;
    }
}
开发者ID:vaiv,项目名称:OpenANPR,代码行数:57,代码来源:lsd.c

示例3: test_yolo

void test_yolo(char *cfgfile, char *weightfile, char *filename, float thresh)
{

    network net = parse_network_cfg(cfgfile);
    if(weightfile){
        load_weights(&net, weightfile);
    }
    detection_layer l = net.layers[net.n-1];
    set_batch_network(&net, 1);
    srand(2222222);
    clock_t time;
    char buff[256];
    char *input = buff;
    int j;
    float nms=.5;
    box *boxes = calloc(l.side*l.side*l.n, sizeof(box));
    float **probs = calloc(l.side*l.side*l.n, sizeof(float *));
    for(j = 0; j < l.side*l.side*l.n; ++j) probs[j] = calloc(l.classes, sizeof(float *));
    while(1){
        if(filename){
            strncpy(input, filename, 256);
        } else {
            printf("Enter Image Path: ");
            fflush(stdout);
            input = fgets(input, 256, stdin);
            if(!input) return;
            strtok(input, "\n");
        }
        image im = load_image_color(input,0,0);
        image sized = resize_image(im, net.w, net.h);
        float *X = sized.data;
        time=clock();
        float *predictions = network_predict(net, X);
        printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
        convert_yolo_detections(predictions, l.classes, l.n, l.sqrt, l.side, 1, 1, thresh, probs, boxes, 0);
        if (nms) do_nms_sort(boxes, probs, l.side*l.side*l.n, l.classes, nms);
        //draw_detections(im, l.side*l.side*l.n, thresh, boxes, probs, voc_names, voc_labels, 20);
        draw_detections(im, l.side*l.side*l.n, thresh, boxes, probs, voc_names, 0, 20);
        show_image(im, "predictions");
        save_image(im, "predictions");

        show_image(sized, "resized");
        free_image(im);
        free_image(sized);
#ifdef OPENCV
        cvWaitKey(0);
        cvDestroyAllWindows();
#endif
        if (filename) break;
    }
}
开发者ID:simonfojtu,项目名称:darknet,代码行数:51,代码来源:yolo.c

示例4: test_writing

void test_writing(char *cfgfile, char *weightfile, char *filename)
{
    network * net = parse_network_cfg(cfgfile);
    if(weightfile){
        load_weights(net, weightfile);
    }
    set_batch_network(net, 1);
    srand(2222222);
    clock_t time;
    char buff[256];
    char *input = buff;
    while(1){
        if(filename){
            strncpy(input, filename, 256);
        }else{
            printf("Enter Image Path: ");
            fflush(stdout);
            input = fgets(input, 256, stdin);
            if(!input) return;
            strtok(input, "\n");
        }

        image im = load_image_color(input, 0, 0);
        resize_network(net, im.w, im.h);
        printf("%d %d %d\n", im.h, im.w, im.c);
        float *X = im.data;
        time=clock();
        network_predict(net, X);
        printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
        image pred = get_network_image(net);

        image upsampled = resize_image(pred, im.w, im.h);
        image thresh = threshold_image(upsampled, .5);
        pred = thresh;

        show_image(pred, "prediction");
        show_image(im, "orig");
#ifdef OPENCV
        cvWaitKey(0);
        cvDestroyAllWindows();
#endif

        free_image(upsampled);
        free_image(thresh);
        free_image(im);
        if (filename) break;
    }
}
开发者ID:kunle12,项目名称:darknet,代码行数:48,代码来源:writing.c

示例5: decode_captcha

void decode_captcha(char *cfgfile, char *weightfile)
{
    setbuf(stdout, NULL);
    srand(time(0));
    network net = parse_network_cfg(cfgfile);
    set_batch_network(&net, 1);
    if(weightfile){
        load_weights(&net, weightfile);
    }
    char filename[256];
    while(1){
        printf("Enter filename: ");
        fgets(filename, 256, stdin);
        strtok(filename, "\n");
        image im = load_image_color(filename, 300, 57);
        scale_image(im, 1./255.);
        float *X = im.data;
        float *predictions = network_predict(net, X);
        image out  = float_to_image(300, 57, 1, predictions);
        show_image(out, "decoded");
        #ifdef OPENCV
        cvWaitKey(0);
        #endif
        free_image(im);
    }
}
开发者ID:Nerei,项目名称:darknet,代码行数:26,代码来源:captcha.c

示例6: show_images

void show_images(image *ims, int n, char *window)
{
    image m = collapse_images_vert(ims, n);
    save_image(m, window);
    show_image(m, window);
    free_image(m);
}
开发者ID:Nerei,项目名称:darknet,代码行数:7,代码来源:image.c

示例7: gtk_image_menu_item_set_image

/**
 * gtk_image_menu_item_set_image:
 * @image_menu_item: a #GtkImageMenuItem.
 * @image: (allow-none): a widget to set as the image for the menu item.
 *
 * Sets the image of @image_menu_item to the given widget.
 * Note that it depends on the show-menu-images setting whether
 * the image will be displayed or not.
 *
 * Deprecated: 3.10
 */
void
gtk_image_menu_item_set_image (GtkImageMenuItem *image_menu_item,
                               GtkWidget        *image)
{
    GtkImageMenuItemPrivate *priv;

    g_return_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item));

    priv = image_menu_item->priv;

    if (image == priv->image)
        return;

    if (priv->image)
        gtk_container_remove (GTK_CONTAINER (image_menu_item),
                              priv->image);

    priv->image = image;

    if (image == NULL)
        return;

    gtk_widget_set_parent (image, GTK_WIDGET (image_menu_item));
    g_object_set (image,
                  "visible", show_image (image_menu_item),
                  "no-show-all", TRUE,
                  NULL);
    gtk_image_set_pixel_size (GTK_IMAGE (image), 16);

    g_object_notify (G_OBJECT (image_menu_item), "image");
}
开发者ID:raja651,项目名称:gtk,代码行数:42,代码来源:gtkimagemenuitem.c

示例8: stack_imgs

IplImage *cmp_two_image(IplImage *src1, IplImage *src2) {
    float **des1, **des2;
    int npts1, npts2;
    int ndes;
    t_point *pts1, *pts2;

//  IplImage *img1 = harris(src1, 0.01, &des1, &npts1, &ndes, &pts1);
//  IplImage *img2 = harris(src2, 0.01, &des2, &npts2, &ndes, &pts2);
    IplImage *print = stack_imgs(src1, src2);
    harris_center(src1, 0.01);
    harris_center(src2, 0.01);

    return NULL;

    /*print des of img1 and img2*/
#ifdef PRINT
    for (int i = 0; i < npts1; i++) {
        for (int j = 0; j < ndes; j++) {
            cout << des1[i][j] << " ";
        }
        cout << endl;
    }
    cout << "\n";
    for (int i = 0; i < npts2; i++) {
        for (int j = 0; j < ndes; j++) {
            cout << des2[i][j] << " ";
        }
        cout << endl;
    }
    cout << "\n";
#endif

    int mark = 0;
    float mdist = 10000;
    for (int i = 0; i < npts1; i++) {
        mdist = 10000;
        for (int j = 0; j < npts2; j++) {
            float dist = 0;

            for (int k = 0; k < ndes; k++) {
                dist += ABS(des1[i][k] - des2[j][k]);
            }
#ifdef PRINT
            cout << dist << " " << i << " " << j << endl;
#endif
            if (dist < mdist) {
                mdist = dist;
                mark = j;
            }
        }
        if (mdist < 0.02) {
            cvLine(print,
                   cvPoint(pts1[i].x, pts1[i].y),
                   cvPoint(pts2[mark].x + src1->width, pts2[mark].y),
                   cvScalar(0, 255, 0), 1);
        }
    }

    show_image(print, "match");
}
开发者ID:cherip,项目名称:Harris,代码行数:60,代码来源:harris.cpp

示例9: main

int main(int argc, char **argv) {
    if(wiringPiSetup() == -1) {
        printf("wiringPiSetup() failed\n");
        return EXIT_FAILURE;
    }

    // 540kHz speed - recomended by ST7920 spec
    //if ((lcd_fd = wiringPiSPISetupMode(0, 540000, 0x07)) < 0) {
    if ((lcd_fd = wiringPiSPISetup(0, 540000)) < 0) {
        printf("Can't open the SPI bus\n");
        return EXIT_FAILURE;
    }
    
    char mode = 0x07;
    ioctl(lcd_fd, SPI_IOC_WR_MODE, &mode);

    init_gpio();
    reset_lcd();
    init_lcd();
    
    set_extended_mode(0, 0, 0);
    set_extended_mode(0, 1, 1);

    clear_lcd();

    show_image(raspberry_pix);

    return EXIT_SUCCESS;
}
开发者ID:banec,项目名称:st9720_spi_test,代码行数:29,代码来源:st7920_spi_test.c

示例10: get_center

CvPoint get_center(IplImage *img) {
    int origW = img->width;
    int origH = img->height;

    ellipseW = origW / factor; 
    ellipseH = origH / factor;
    mask = new unsigned char[ellipseH * ellipseW];
    init_mask(ellipseW, ellipseH);
    //num = ellipseH * ellipseW;

    int half_w = ellipseW / 2;
    int half_h = ellipseH / 2;
    int ctrX, ctrY;
    float maxComplax;

    for (int y = half_h; y < origH - half_h; y++) {
        for (int x = half_w; x < origW - half_w; x++) {
//          cvSetImageROI(img, cvEllipse(
            float complaxVal = get_complax(img, x, y, ellipseW, ellipseH);
//          printf("%f %d %d\n", complaxVal, x, y);
            if (complaxVal > maxComplax) {
                maxComplax = complaxVal;
                ctrX = x;
                ctrY = y;
            }
        }
    }

    cvCircle(img, cvPoint(ctrX, ctrY), half_h, cvScalar(0, 255, 9));
    printf("%d %d\n", ctrX, ctrY);
    show_image(img, "center");

    return cvPoint(ctrX, ctrY);
}
开发者ID:cherip,项目名称:dct,代码行数:34,代码来源:ellipse.cpp

示例11: show_images_and_delay

/**
 * need comment here
 */
static int show_images_and_delay(BmpBlockHeader *bmph, int local, int index)
{
	int i;
	ScreenLayout *screen;
	ImageInfo *image;

	screen = (ScreenLayout *)(bmph + 1);
	screen += local * bmph->number_of_screenlayouts;
	screen += index;

	for (i = 0;
	     i < MAX_IMAGE_IN_LAYOUT && screen->images[i].image_info_offset;
	     i++) {
		image = (ImageInfo *)((uint8_t *)bmph +
				screen->images[i].image_info_offset);
		if (show_image(image, screen->images[i].x,
				screen->images[i].y))
			goto bad;
	}

	VbExSleepMs(1000);
	return 0;

bad:
	VbExDebug("Failed to display image, screen=%lu, image=%d!\n", index, i);
	return 1;
}
开发者ID:ArthySundaram,项目名称:u-boot-chromebook,代码行数:30,代码来源:cmd_vbexport_test.c

示例12: draw_coco

void draw_coco(image im, float *pred, int side, char *label)
{
    int classes = 1;
    int elems = 4+classes;
    int j;
    int r, c;

    for(r = 0; r < side; ++r){
        for(c = 0; c < side; ++c){
            j = (r*side + c) * elems;
            int class = max_index(pred+j, classes);
            if (pred[j+class] > 0.2){
                int width = pred[j+class]*5 + 1;
                printf("%f %s\n", pred[j+class], "object"); //coco_classes[class-1]);
                float red = get_color(0,class,classes);
                float green = get_color(1,class,classes);
                float blue = get_color(2,class,classes);

                j += classes;

                box predict = {pred[j+0], pred[j+1], pred[j+2], pred[j+3]};
                predict.x = (predict.x+c)/side;
                predict.y = (predict.y+r)/side;
                
                draw_bbox(im, predict, width, red, green, blue);
            }
        }
    }
    show_image(im, label);
}
开发者ID:crystalphi,项目名称:darknet,代码行数:30,代码来源:coco.c

示例13: run

        // the main device method
        virtual void run() {

            if(!opened) {

                scene->addItem(item);

                // lock the image viewer
                img_view_mutex.lock();

                // update the pixmap and unlock the image viewer
                show_image();

                // open a window to show the QGraphicsScene
                view->show();

                // set the flag to true
                opened = true;

            } else {

                if (img_view_mutex.try_lock())  {

                    // a new thread!
                    std::thread show_image_thread(&ImageViewerDevice::show_image, this);

                    // leave it alone
                    show_image_thread.detach();

                }

            }

        }
开发者ID:josiasalexandre,项目名称:smoothPursuit,代码行数:34,代码来源:ImageViewerDevice.hpp

示例14: gtk_image_menu_item_set_always_show_image

/**
 * gtk_image_menu_item_set_always_show_image:
 * @image_menu_item: a #GtkImageMenuItem
 * @always_show: %TRUE if the menuitem should always show the image
 *
 * If %TRUE, the menu item will ignore the #GtkSettings:gtk-menu-images
 * setting and always show the image, if available.
 *
 * Use this property if the menuitem would be useless or hard to use
 * without the image.
 *
 * Since: 2.16
 *
 * Deprecated: 3.10
 */
void
gtk_image_menu_item_set_always_show_image (GtkImageMenuItem *image_menu_item,
        gboolean          always_show)
{
    GtkImageMenuItemPrivate *priv;

    g_return_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item));

    priv = image_menu_item->priv;

    if (priv->always_show_image != always_show)
    {
        priv->always_show_image = always_show;

        if (priv->image)
        {
            if (show_image (image_menu_item))
                gtk_widget_show (priv->image);
            else
                gtk_widget_hide (priv->image);
        }

        g_object_notify (G_OBJECT (image_menu_item), "always-show-image");
    }
}
开发者ID:raja651,项目名称:gtk,代码行数:40,代码来源:gtkimagemenuitem.c

示例15: QLabel

MainWindow::MainWindow()
{
    img_label = new QLabel("",0);
    setCentralWidget(img_label);

    createActions();
    createMenus();
    createToolBar();

    powertfDlg = 0;
    edgedetectDlg = 0;
    houghDlg = 0;
    morphDlg = 0;
    blurDlg = 0;
    histeqDlg = 0;
    facedetectDlg = 0;

    cam_on = false;
    cam_save = false;
    capture = 0;

    setWindowIcon(QIcon(":/images/title.png"));

    img = imread("images/Home.png", 1);
    img.copyTo(cur_img);
    show_image();
}
开发者ID:fei-GitHub,项目名称:opencv_study,代码行数:27,代码来源:main_window.cpp


注:本文中的show_image函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。