FFT in C++ AMP Throw CLIPBRD_E_CANT_OPEN error - directx

I am trying to use C++ AMP in Visual C++ 2017 on Windows 10 (updated to the latest) and I find the archived FFT library from C++ AMP team on codeplex. I try to run the sample code, however the program throws ran out of memory error when creating DirectX FFT. I solve that problem by following the thread on Microsoft forum.
However, the problem doesn't stop. When the FFT library tries to create Unordered Access View, it throws error of CLIPBRD_E_CANT_OPEN. I did not try to operate on clipboard anyhow.
Thank you for reading this!

It seems I solve the problem. The original post mentioned that we need to create a new DirectX device and then create accelerator view upon it. Then I pass that view to ctor of fft as the second parameter.
fft(
concurrency::extent<_Dim> _Transform_extent,
const concurrency::accelerator_view& _Av = concurrency::accelerator().default_view,
float _Forward_scale = 0.0f,
float _Inverse_scale = 0.0f)
However, I still have crashes of the CLIPBRD_E_CANT_OPEN.
After reading the code, I realize that I need to create array on that DirectX views too. So I started to change:
array<std::complex<float>,dims> transformed_array(extend, directx_acc_view);
The idea comes from the different behaviors of create_uav(). The internal buffers and the precomputing caused no problem, but the samples' calls trigger the clipboard error. I guess the device matters here, so I do that change.
I hope my understanding is correct and anyway there is no such errors now.

Related

directx feature level and code

I coded a program with direct11 and my feature level coded like this
unsigned int featureLevel[4] =
{
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0
};
I am curious that why this program can work in feature level 10 even if I coded only direct11?
If I used direct11 version functions, should the program run only direct11?
I think the feature levels have nothing to do with directx api version. Different feature level has different feature which is useful for game developer such as partial constant buffer updates,16bpp rendering, partial clears and so on.

Embedded opencv window in MFC, ERROR

I wrote code to embed opencv window in picture box in MFC. The successful state should be opencv window in the MFC and display pics in MFC. However, my code still make the opencv window flowing around. And I can't find where the problem would be. Any one can help me out?
I will appreciate it.
BOOL SENSEIDlg_XQ::OnInitDialog(){
CDialog::OnInitDialog();
namedWindow("VIDEO",0);
HWND hWnd_video = (HWND)cvGetWindowHandle("VIDEO");
::SetParent(hWnd_video,GetDlgItem(IDC_STATIC_PIC1)->m_hWnd);
HWND video_parent = ::GetParent(hWnd_video);
::ShowWindow(video_parent,SW_HIDE);
return TRUE;
The IDC_STATIC_PIC1 is a picture box in a Cdialog.
I've already figured it out. Write out the solutions for other users who may bump into the same problems. change namedWindow into cvNamedWindow. Apparently, C library is better than C++ here. If you guys bump into the same problem try this.

alternative to cvWaitKey() function in iOS

ok, what i am trying to do is retrieve a frame from an existing video file, do some work on the frame and then save it to a new file,
what actually happens is that it writes some frames and then crashes as the code is quite fast,
if i don't put cvWaitKey() i get the same error i get when writing video frames with AVFoundation Library without using
AVAssetWriterInput.readyForMoreMediaData
OpenCV video writer is implemented using AVFoundation classes but we lose access to
AVAssetWriterInput.readyForMoreMediaData
or am i missing something ?
here is the code similar to what i'm trying to do,
while (grabResult&&frameResult) {
grabResult = cvGrabFrame(capture); // capture a frame
if(grabResult){
img = cvRetrieveFrame(capture, 0); // retrieve the captured frame
cvFlip(img,NULL,0); // edit img
frameResult = cvWriteFrame(writer,img); // add the frame to the file
cvWaitKey(-1); or anything that helps to finish adding the previous frame
}
}
I am trying to convert a video file using OpenCV (without displaying)
in my iPhone/iPad app, everything works except cvWaitKey() function
and I get this error:
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvWaitKey,
Without this function frames are dropped as there's no way to know if
the video writer is ready, is there an alternative to my problem?
I am using OpenCV 2.4.2 and I get same error with the latest
precompiled version of OpenCV.
Repaint the UIImageView:
[[NSRunLoop currentRunLoop]runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.0f]];
followed by your imshow or cvShowImage
I don't know anything about iOS development, but did you try calling the C++ interface method waitKey()?

OpenCV Line-Mod problems with Images

I'm trying to use line-mod (in special line-2d) in opencv 2.4 to compare images. At the moment I try to change the test-implementation linemod.cpp to use an input images instead of the camera, but without any success.
I tried to load an image via imread('...', CV_LOAD_IMAGE_COLOR); and pushed that in the sources vector but got a 'OpenCV Error: Assertion failed (response_map.rows % T == 0) in linearize' error.
If I load a CV_LOAD_IMAGE_GRAYSCALE image the run stops at detector->match with the error 'Thread 1: EXC_BAD_ACCESS (code=1, address=0x11310f000)'.
I don't understand what makes the difference between images coming from a VideoCapturer and from imread...
Is there anyone out there that may help me? I'm totally lost ... again ;-)
(For example sample code for matching two objects from images with linemod would be absolutely great!)
I use opencv 2.4 with xcode on a mac.
Maybe it is too late for an answer, but I am also interested in the algorithm
In the OpenCV Minutes 2012-06-26 ( http://code.opencv.org/projects/opencv/wiki/2012 ) you can read:
Will work with Stefan Hinterstoisser for final version of LINEMOD by September
So if you did not already solve it, you may want to wait.

xtaskcreate-getting error

Hello I am working on EZ430-RF2560T target board attached to debugging interface (attached to USB of PC) for the Tux Racer game application (MSP430BT5190 target board ). I am working on the accelerometer application code. After the bluetooth is turned On it gives the message "unable to create task " for the function
xTaskCreate((pdTASK_CODE) user_task_routine,
(const signed portCHAR *)USER_TASK_NAME,
USER_TASK_STACK_SIZE, (unsigned portLONG *)NULL,
(unsigned portBASE_TYPE)USER_TASK_PRIORITY,
(xTaskHandle *) NULL);
Please let me know what could be done.........
Thankyou
Ashwin
Hard to say without more info or code. Looks like the task create line is straight from some dummy documentation or sample. Have you defined all the relevant parts such as USER_TASK_NAME, USER_TASK_STACK_SIZE, USER_TASK_PRIORITY, and especially the function user_task_routine?
Were there any compiler errors in this module?
The name "user task" sounds rather generic, maybe you might consider a descriptive name :)
Are other demo tasks running on the board? You might compare your task to them and see how they are started.
Could you simply be running out of memory? Try disabling some of the other tasks and starting only your task.
There is also a support community at freertos.org that tends to provide helpful responses.

Resources