mirror of https://github.com/opencv/opencv.git
Open Source Computer Vision Library
https://opencv.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
956 B
31 lines
956 B
#!/usr/bin/env python |
|
|
|
import os |
|
import numpy as np |
|
import math |
|
import unittest |
|
import cv2 as cv |
|
|
|
from tests_common import NewOpenCVTests |
|
|
|
class octree_test(NewOpenCVTests): |
|
def test_octree_basic_test(self): |
|
pointCloudSize = 1000 |
|
resolution = 0.0001 |
|
scale = 1 << 20 |
|
|
|
pointCloud = np.random.randint(-scale, scale, size=(pointCloudSize, 3)) * (10.0 / scale) |
|
pointCloud = pointCloud.astype(np.float32) |
|
|
|
octree = cv.Octree_createWithResolution(resolution, pointCloud) |
|
|
|
restPoint = np.random.randint(-scale, scale, size=(1, 3)) * (10.0 / scale) |
|
restPoint = [restPoint[0, 0], restPoint[0, 1], restPoint[0, 2]] |
|
|
|
self.assertTrue(octree.isPointInBound(restPoint)) |
|
self.assertFalse(octree.deletePoint(restPoint)) |
|
self.assertTrue(octree.insertPoint(restPoint)) |
|
self.assertTrue(octree.deletePoint(restPoint)) |
|
|
|
if __name__ == '__main__': |
|
NewOpenCVTests.bootstrap()
|
|
|