@@ -40,7 +40,7 @@ void ofApp::setup() {
40
40
particleVec[i].x = ofRandom (-20 , 20 );
41
41
particleVec[i].y = ofRandom (-20 , 20 );
42
42
43
- particleCol[i].set (ofRandom (250 ), ofRandom (250 ), ofRandom (250 ));
43
+ particleCol[i].set (ofRandom (250 ), ofRandom (250 ), ofRandom (200 , 250 ));
44
44
cout << particleVec[0 ].x << endl;
45
45
}
46
46
@@ -230,12 +230,12 @@ void ofApp::draw() {
230
230
flowValue[i] = flowValue[i+1 ];
231
231
}
232
232
}
233
-
234
- drawEffect ();
233
+
234
+ // drawEffect(); //状態毒
235
235
if (mode){drawCap ();}
236
236
if (!mode){drawLocus ();}
237
237
drawCol ();
238
- drawSub ();
238
+ // drawSub();
239
239
if (drawpast){drawPast ();}
240
240
if (drawpastBack){drawPastBack ();}
241
241
if (reguner){drawRegular ();}
@@ -277,8 +277,9 @@ void ofApp::draw() {
277
277
278
278
// ofDisableAlphaBlending();
279
279
bgSubtraction ();
280
- drawEffect ();
280
+ // drawEffect();
281
281
282
+ ofSetColor (255 );
282
283
curFlow -> draw (0 ,0 ,camWidth,camHeight);
283
284
gui.setPosition (camWidth * 2 + 10 , 10 );
284
285
cv.setPosition (camWidth * 2 + 10 , camHeight);
@@ -570,22 +571,30 @@ void ofApp::bgSubtraction() {
570
571
diffGrayImg.draw (camWidth, 0 );
571
572
572
573
// draw
573
- ofTranslate (camWidth, 0 );
574
+ // ofTranslate(camWidth, 0);
574
575
myContourFinder.draw ();
575
576
576
- int numPerticle = 1 ;
577
+ int numPerticle = 3 ;
577
578
578
579
for (int i = 0 ; i < numPerticle; i++){
579
- if (myContourFinder.size () <= 0 ) { // or動きが少ない時
580
+ if (myContourFinder.size () <= 0 || flowAve < 2 ) {
580
581
break ;
581
582
}
582
583
cv::Point2f drawpoint = myContourFinder.getCenter (i);
583
584
ofSetColor (255 , 0 , 0 );
584
585
ofCircle (drawpoint.x , drawpoint.y , 10 );
586
+ for (int i=0 ; i<100 ; i++){
587
+ ofSetColor (particleCol[i]);
588
+ particle[i].x += particleVec[i].x ;
589
+ particle[i].y += particleVec[i].y ;
590
+ if (particle[i].x > camWidth || particle[i].x < 0 ){particle[i].y = drawpoint.y ;particle[i].x = drawpoint.x ;}
591
+ if (particle[i].y > camHeight || particle[i].y < 0 ){particle[i].y = drawpoint.y ;particle[i].x = drawpoint.x ;}
592
+ ofCircle (particle[i].x , particle[i].y ,particle[i].z );
593
+ }
585
594
}
586
595
587
596
ofColor (255 );
588
- ofTranslate (-camWidth, 0 );
597
+ // ofTranslate(-camWidth, 0);
589
598
590
599
}
591
600
/* *
@@ -637,10 +646,11 @@ void ofApp::drawFlowCap(){
637
646
638
647
639
648
for (int i=0 ; i<flameMax; i++){
640
- if (flowValue[i] > 8 ){
649
+ if (flowValue[i] > 12 ){
641
650
if (capFlow[i].bAllocated ()){
642
651
ofSetColor (255 ,255 ,255 ,ofMap (i, 0 , flameMax, 0 , 255 ));
643
652
capFlow[i].draw (0 ,0 );
653
+ i++;
644
654
}
645
655
}
646
656
}
@@ -762,25 +772,16 @@ void ofApp::drawFlowCap(){
762
772
}
763
773
764
774
765
- void ofApp::drawEffect (){
766
-
767
-
768
- if (flowAve < 5 ){
769
- changeCol = 0 ;
770
- }else if (flowAve < 15 ){
771
- changeCol = 2 ;
772
- }else if (flowAve < 25 ){
773
- changeCol = 3 ;
774
- }else {
775
- changeCol = 1 ;
776
- }
777
- ofSetColor (0 );
778
- for (int i=0 ; i<100 ; i++){
779
- ofSetColor (particleCol[i]);
780
- particle[i].x += particleVec[i].x ;
781
- particle[i].y += particleVec[i].y ;
782
- if (particle[i].x > camWidth || particle[i].x < 0 ){particle[i].x = camWidth/2 ;particle[i].y = camHeight/2 ;}
783
- if (particle[i].y > camHeight || particle[i].y < 0 ){particle[i].y = camHeight/2 ;particle[i].x = camWidth/2 ;}
784
- ofCircle (particle[i].x , particle[i].y ,particle[i].z );
785
- }
786
- }
775
+ // void ofApp::drawEffect(){
776
+ //
777
+ // //状態毒
778
+ // if(flowAve < 5){
779
+ // changeCol = 0;
780
+ // }else if(flowAve < 15){
781
+ // changeCol = 2;
782
+ // }else if (flowAve < 25){
783
+ // changeCol = 3;
784
+ // }else{
785
+ // changeCol = 1;
786
+ // }
787
+ // }
0 commit comments