@@ -292,6 +292,18 @@ export default {
292292 this .$store .commit (' setIndex' , 0 )
293293 this .usedPattern = this .generateRuntimePattern ()
294294
295+ if (this .usedPattern .length === 0 ) {
296+ const width = window .innerWidth
297+ const height = window .innerHeight
298+ const offset = this .offset || 100
299+ const pointCount = this .$store .state .calibration .pointNumber
300+
301+ const generatedPattern = this .generateCalibrationPattern (pointCount, width, height, offset)
302+
303+ this .$store .commit (' setMockPattern' , generatedPattern)
304+ this .usedPattern = generatedPattern
305+
306+ }
295307 await this .startWebCamCapture ();
296308 console .log (" chamou drawPoint no created com os valores:" , this .usedPattern [0 ].x , this .usedPattern [0 ].y );
297309 this .drawPoint (this .usedPattern [0 ].x , this .usedPattern [0 ].y , 1 )
@@ -300,6 +312,108 @@ export default {
300312
301313 },
302314 methods: {
315+ generateCalibrationPattern (pointCount , width , height , offset ) {
316+ const patterns = [];
317+
318+ switch (pointCount) {
319+ case 1 :
320+ // Center point only
321+ patterns .push ({ x: width/ 2 , y: height/ 2 });
322+ break ;
323+
324+ case 2 :
325+ // Left and right edges (horizontal coverage)
326+ patterns .push ({ x: offset, y: height/ 2 });
327+ patterns .push ({ x: width - offset, y: height/ 2 });
328+ break ;
329+
330+ case 3 :
331+ // Horizontal line: left, center, right
332+ patterns .push ({ x: offset, y: height/ 2 });
333+ patterns .push ({ x: width/ 2 , y: height/ 2 });
334+ patterns .push ({ x: width - offset, y: height/ 2 });
335+ break ;
336+
337+ case 4 :
338+ // Four corners (optimal for 4-point calibration)
339+ patterns .push ({ x: offset, y: offset });
340+ patterns .push ({ x: width - offset, y: offset });
341+ patterns .push ({ x: offset, y: height - offset });
342+ patterns .push ({ x: width - offset, y: height - offset });
343+ break ;
344+
345+ case 5 :
346+ // Four corners + center (cross pattern)
347+ patterns .push ({ x: offset, y: offset });
348+ patterns .push ({ x: width - offset, y: offset });
349+ patterns .push ({ x: width/ 2 , y: height/ 2 });
350+ patterns .push ({ x: offset, y: height - offset });
351+ patterns .push ({ x: width - offset, y: height - offset });
352+ break ;
353+
354+ case 6 : {
355+ // 3x2 rectangle pattern
356+ const stepX6 = (width - 2 * offset) / 2 ;
357+ const stepY6 = (height - 2 * offset) / 1 ;
358+ for (let i = 0 ; i < 2 ; i++ ) {
359+ for (let j = 0 ; j < 3 ; j++ ) {
360+ patterns .push ({
361+ x: offset + j * stepX6,
362+ y: offset + i * stepY6,
363+ });
364+ }
365+ }
366+ break ;
367+ }
368+
369+ case 7 :
370+ // Partial 3x3 grid (strategic selection)
371+ patterns .push ({ x: offset, y: offset });
372+ patterns .push ({ x: width/ 2 , y: offset });
373+ patterns .push ({ x: width - offset, y: offset });
374+ patterns .push ({ x: offset, y: height/ 2 });
375+ patterns .push ({ x: width - offset, y: height/ 2 });
376+ patterns .push ({ x: offset, y: height - offset });
377+ patterns .push ({ x: width - offset, y: height - offset });
378+ break ;
379+
380+ case 8 :
381+ // Partial 3x3 grid (without center)
382+ patterns .push ({ x: offset, y: offset });
383+ patterns .push ({ x: width/ 2 , y: offset });
384+ patterns .push ({ x: width - offset, y: offset });
385+ patterns .push ({ x: offset, y: height/ 2 });
386+ patterns .push ({ x: width - offset, y: height/ 2 });
387+ patterns .push ({ x: offset, y: height - offset });
388+ patterns .push ({ x: width/ 2 , y: height - offset });
389+ patterns .push ({ x: width - offset, y: height - offset });
390+ break ;
391+
392+ case 9 :
393+ default : {
394+ // Full 3x3 grid (current working pattern)
395+ const cols = 3 ;
396+ const rows = 3 ;
397+ const usableWidth = width - 2 * offset;
398+ const usableHeight = height - 2 * offset;
399+ const stepX = usableWidth / (cols - 1 );
400+ const stepY = usableHeight / (rows - 1 );
401+
402+ for (let i = 0 ; i < rows; i++ ) {
403+ for (let j = 0 ; j < cols; j++ ) {
404+ patterns .push ({
405+ x: offset + j * stepX,
406+ y: offset + i * stepY,
407+ });
408+ }
409+ }
410+ break ;
411+ }
412+ }
413+
414+ return patterns;
415+ },
416+
303417 startTraining () {
304418 this .showStepper = false ;
305419 this .calibrationStarted = true ;
@@ -520,6 +634,10 @@ export default {
520634 this .usedPattern [a].predictionX = element .predicted_x
521635 this .usedPattern [a].predictionY = element .predicted_y
522636 }
637+
638+ // Update the store's pattern with the prediction data
639+ this .$store .commit (' setPattern' , this .usedPattern )
640+
523641 this .$store .dispatch (' extractXYValues' , { extract: this .circleIrisPoints , hasCalib: true })
524642 this .$store .dispatch (' extractXYValues' , { extract: this .calibPredictionPoints , hasCalib: false })
525643
0 commit comments