예제 #1
0
def process_image(img, image_pub, clf):
    print "Got image!"

    some_observations = observe(img)
    print '-------------------------' 
    segmentation = np.array([x for x in [clf.predict(obs) for obs in some_observations]])
    segmentation_image = np.reshape(segmentation, img[:, :, 2].shape)

    image_pub.publish(np.dstack([(segmentation_image * 250).astype(np.uint8)] * 3))
    print "Pubbing Image"
예제 #2
0
def process_image(img, image_pub, clf):
    print "Got image!"

    some_observations = observe(img)
    print '-------------------------'
    segmentation = np.array(
        [x for x in [clf.predict(obs) for obs in some_observations]])
    segmentation_image = np.reshape(segmentation, img[:, :, 2].shape)

    image_pub.publish(
        np.dstack([(segmentation_image * 250).astype(np.uint8)] * 3))
    print "Pubbing Image"
예제 #3
0
        attributes = {
            'times': [],
            'true_positives': [],
            'false_positives': [],
        }
        for u_image, u_mask, image_name in data:
            if u_image is None or u_mask is None:
                continue

            print "Image:",image_name

            image = u_image[::2, ::2, :]
            mask = u_mask[::2, ::2]
            tic_observation = time()
            some_observations = observe(image)
            print '-------------------------'
            print 'Observing took {} seconds'.format(time() - tic_observation)
            tic_prediction = time()

            try:
                segmentation = [x for x in [clf.predict(obs) for obs in some_observations]]
            except:
                print "Failed to load. File probably doesn't exist"
                break

            print 'Predicting took {} seconds'.format(time() - tic_prediction)
            total_time = time() - tic_observation

            segmentation_image = np.reshape(segmentation, image[:, :, 2].shape)
            # cv2.imshow('im2', image)
예제 #4
0
        attributes = {
            'times': [],
            'true_positives': [],
            'false_positives': [],
        }
        for u_image, u_mask, image_name in data:
            if u_image is None or u_mask is None:
                continue

            print "Image:", image_name

            image = u_image[::2, ::2, :]
            mask = u_mask[::2, ::2]
            tic_observation = time()
            some_observations = observe(image)
            print '-------------------------'
            print 'Observing took {} seconds'.format(time() - tic_observation)
            tic_prediction = time()

            try:
                segmentation = [
                    x for x in [clf.predict(obs) for obs in some_observations]
                ]
            except:
                print "Failed to load. File probably doesn't exist"
                break

            print 'Predicting took {} seconds'.format(time() - tic_prediction)
            total_time = time() - tic_observation