point cloud can be manipulated through rotate and zoom
diff --git a/src/main/resources/templates/js/app.js b/src/main/resources/templates/js/app.js index 2c8743b8c790e402a180fe41bfbf2d19d28d47c8..37fea7d24708ed45c40a37df85717bfe60b95b69 100644 --- a/src/main/resources/templates/js/app.js +++ b/src/main/resources/templates/js/app.js @@ -5,25 +5,17 @@ async function fetchImageAndObjects() { throw new Error('Failed to fetch image and objects'); } const data = await response.json(); - console.log(data) - displayImageAndObjects(data.imageUrl, data.objects); + + displayImageAndObjects(data.objects); } catch (error) { console.error(error); } } -function displayImageAndObjects(imageUrl, objects) { - const imageContainer = document.getElementById('imageContainer'); +function displayImageAndObjects(objects) { const objectsContainer = document.getElementById('objectsContainer'); const container = document.getElementById('resultContainer'); - // Create an image element - const imageElement = document.createElement('img'); - console.log(imageUrl); - imageElement.src = 'http://127.0.0.1:5555/' + imageUrl; - imageElement.alt = 'Image'; - imageContainer.appendChild(imageElement); - // Create a list for objects const objectsList = document.createElement('ul'); objects.forEach(object => { @@ -58,19 +50,22 @@ function displayLoading() { function hideLoading() { loader.classList.remove("display"); } + async function startWorkflow(){ const startButton = document.getElementById("process"); startButton.style.display = "none"; displayLoading(); try { - const response = await fetch('http://127.0.0.1:5555/runProcess'); + const response = await fetch('http://127.0.0.1:5000/runProcess'); if (!response.ok) { throw new Error('Failed to fetch image and objects'); } const data = await response; + console.log(data); hideLoading(); } catch (error) { console.error(error); } - await fetchImageAndObjects(); -} + fetchImageAndObjects(); + +} \ No newline at end of file diff --git a/src/main/resources/templates/js/pointCloud.js b/src/main/resources/templates/js/pointCloud.js index 6a3eadf88364f87dc2930ae97b2e25b6c95244da..308687971ada84925dc77d653afae1c687e5ab10 100644 --- a/src/main/resources/templates/js/pointCloud.js +++ b/src/main/resources/templates/js/pointCloud.js @@ -1,14 +1,9 @@ async function drawPointCloud(object) { - var button = document.getElementById("drawPC"); - button.style.display = 'none'; - await fetch('http://127.0.0.1:5555/getJSON') .then(response => response.json()) .then(responseText => { let pointCloudData = parseJSONToPointCloud(responseText, object); - console.log(responseText) - // Use three.js to render the point cloud let scene = new THREE.Scene(); let camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); @@ -102,16 +97,16 @@ async function drawPointCloud(object) { if (target in jsonObject || target == null) { for (let objectKey in jsonObject) { - let object = jsonObject[objectKey]; - + let object = jsonObject[objectKey]['pset']; + // Loop through each coordinate in the object for (let i = 0; i < object.length; i++) { let coordinate = object[i]; // Extract x, y, z values - let x = coordinate[0]; - let y = coordinate[1]; - let z = coordinate[2]; + let x = coordinate['x']; + let y = coordinate['y']; + let z = coordinate['z']; let r,g,b; if(objectKey == target){ @@ -141,4 +136,4 @@ async function drawPointCloud(object) { .catch(error => { console.error('Error loading JSON:', error); }); -} +} \ No newline at end of file diff --git a/target/classes/object_detection/ObjectDetector.class b/target/classes/object_detection/ObjectDetector.class index 26831dd84c259632daeb892229a30a8a0bc1fe55..ddacf361e166cadf631b21a9b6f4c39f14aadac6 100644 Binary files a/target/classes/object_detection/ObjectDetector.class and b/target/classes/object_detection/ObjectDetector.class differ diff --git a/target/classes/object_detection/types/ObjectSet.class b/target/classes/object_detection/types/ObjectSet.class index 433f54da882da3826ff47b2199e78c1a75510480..0a4ffd7ed9817123696385db572e8859d62c69d5 100644 Binary files a/target/classes/object_detection/types/ObjectSet.class and b/target/classes/object_detection/types/ObjectSet.class differ diff --git a/target/classes/object_detection/types/Point.class b/target/classes/object_detection/types/Point.class index 6678f02bb179677df5bfbc31e645e558bfc3b130..a6592cfc516f14642a288dffe40173a0567a95cd 100644 Binary files a/target/classes/object_detection/types/Point.class and b/target/classes/object_detection/types/Point.class differ diff --git a/target/classes/templates/html/index.html b/target/classes/templates/html/index.html index ad5e2250be45958d30e7ab77662db567cb059800..ad4a36d45fdd57432ac830eb245a9ac8de8b3a45 100644 --- a/target/classes/templates/html/index.html +++ b/target/classes/templates/html/index.html @@ -16,9 +16,6 @@point cloud can be manipulated through rotate and zoom
diff --git a/target/classes/templates/js/app.js b/target/classes/templates/js/app.js index 2c8743b8c790e402a180fe41bfbf2d19d28d47c8..d17ff58ebe52b79ae48868cd2717a90232e8d375 100644 --- a/target/classes/templates/js/app.js +++ b/target/classes/templates/js/app.js @@ -5,25 +5,19 @@ async function fetchImageAndObjects() { throw new Error('Failed to fetch image and objects'); } const data = await response.json(); + console.log(data) - displayImageAndObjects(data.imageUrl, data.objects); + + displayImageAndObjects(data.objects); } catch (error) { console.error(error); } } -function displayImageAndObjects(imageUrl, objects) { - const imageContainer = document.getElementById('imageContainer'); +function displayImageAndObjects(objects) { const objectsContainer = document.getElementById('objectsContainer'); const container = document.getElementById('resultContainer'); - // Create an image element - const imageElement = document.createElement('img'); - console.log(imageUrl); - imageElement.src = 'http://127.0.0.1:5555/' + imageUrl; - imageElement.alt = 'Image'; - imageContainer.appendChild(imageElement); - // Create a list for objects const objectsList = document.createElement('ul'); objects.forEach(object => { @@ -58,6 +52,7 @@ function displayLoading() { function hideLoading() { loader.classList.remove("display"); } + async function startWorkflow(){ const startButton = document.getElementById("process"); startButton.style.display = "none"; @@ -68,9 +63,11 @@ async function startWorkflow(){ throw new Error('Failed to fetch image and objects'); } const data = await response; + console.log(data); hideLoading(); } catch (error) { console.error(error); } - await fetchImageAndObjects(); -} + fetchImageAndObjects(); + +} \ No newline at end of file diff --git a/target/classes/templates/js/pointCloud.js b/target/classes/templates/js/pointCloud.js index 6a3eadf88364f87dc2930ae97b2e25b6c95244da..308687971ada84925dc77d653afae1c687e5ab10 100644 --- a/target/classes/templates/js/pointCloud.js +++ b/target/classes/templates/js/pointCloud.js @@ -1,14 +1,9 @@ async function drawPointCloud(object) { - var button = document.getElementById("drawPC"); - button.style.display = 'none'; - await fetch('http://127.0.0.1:5555/getJSON') .then(response => response.json()) .then(responseText => { let pointCloudData = parseJSONToPointCloud(responseText, object); - console.log(responseText) - // Use three.js to render the point cloud let scene = new THREE.Scene(); let camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); @@ -102,16 +97,16 @@ async function drawPointCloud(object) { if (target in jsonObject || target == null) { for (let objectKey in jsonObject) { - let object = jsonObject[objectKey]; - + let object = jsonObject[objectKey]['pset']; + // Loop through each coordinate in the object for (let i = 0; i < object.length; i++) { let coordinate = object[i]; // Extract x, y, z values - let x = coordinate[0]; - let y = coordinate[1]; - let z = coordinate[2]; + let x = coordinate['x']; + let y = coordinate['y']; + let z = coordinate['z']; let r,g,b; if(objectKey == target){ @@ -141,4 +136,4 @@ async function drawPointCloud(object) { .catch(error => { console.error('Error loading JSON:', error); }); -} +} \ No newline at end of file