Skip to content

Commit

Permalink
Merge pull request #5 from arsh73552/main
Browse files Browse the repository at this point in the history
Update kMeans.js
  • Loading branch information
arsh73552 authored Jul 10, 2023
2 parents 2987efc + 5047cb8 commit 57cdeb4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Backend/src/kMeans.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
async function kMeans(K, numChannel){
const convert = require("./matrixToImage");
const { createCanvas, Image, getImageData} = require('canvas');
function arrayToMatrix(array, width ,height){
function arrayToMatrix(array, width ,height){
var matrix = [];
var temp = [];
for(var i=0; i<=(height * width); i++){
Expand All @@ -12,7 +9,11 @@ async function kMeans(K, numChannel){
temp.push(array[i]);
}
return matrix;
}
}

async function kMeans(K, numChannel){
const convert = require("./matrixToImage");
const { createCanvas, Image, getImageData} = require('canvas');

function getRandomPixels(matrix){
l = matrix.length;
Expand Down Expand Up @@ -100,4 +101,4 @@ async function kMeans(K, numChannel){
}


module.exports = {kMeans};
module.exports = {kMeans, arrayToMatrix};

0 comments on commit 57cdeb4

Please sign in to comment.