'How to improve the speed of opencv::videowriter::write
When I try recording videos by OpenCV, The grab thread got 210 frames from my camera with 1280*1024 resolution per second, however, the write thread can only process about 35 frames per second. Is there any way to improve the writing speed?
The following code is the run function of the writing thread, I have confirmed that the write function makes the queue buildup.
void recordThread::run(){
int count=0;
cv::Mat mat,tmp;
while (runFlag){
if(que->size()>0){
mat = this->que->dequeue();
count+=1;
if(count%100==0){
qDebug()<<count<<que->size();
}
cv::cvtColor(mat,tmp,cv::COLOR_RGB2BGR);
outputVideo<<tmp;
free(mat.data);
}
}
}
Solution 1:[1]
Hope I know what happens,
into service you call ngOnInit(), but Angular Service don't have that live hooks, btw you should be implements they.
Thats mean on first click you dont have AuthenticationService.logins, then when you call checkCredentials(), AuthenticationService.logins is undefined, and you get your error.
How to solve it? Easiest way - copy into constructor
constructor(private router: Router, private service: SharedService) {
this.getLogins();
console.log(this.logins);
}
Solution 2:[2]
Hi for double click you cannot use ngSubmit event binding on form.use dblclick event on button and capture that.
<div class="central-form">
<form class="login-form" [formGroup]="loginForm" autocomplete="disabled">
<div class="form-group">
<label for="exampleInputEmail1">Email</label>
<input type="email" class="form-control" name="email" aria-describedby="emailHelp" placeholder="Enter email" formControlName="email" autocomplete="new-email">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" placeholder="Password" formControlName="password">
</div>
<div class="form-group" *ngIf = "triedLogin == true && approvedLogin == false">
<span class="error">Invalid E-mail or Password</span>
</div>
<button type="submit" (dblclick)="checkLogin()" class="btn btn-primary" [disabled]="!loginForm.valid">Submit</button>
</form>
</div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | gzn |
| Solution 2 | aakash gupta |
