[cffi-devel] how do i convert this code block into lisp

Joeish W joeish80829 at yahoo.com
Fri Oct 25 01:37:19 UTC 2013


Here is the code block which runs perfect in c



    CvHistogram* hist;
    {
        int hist_size[] = { h_bins, s_bins };
        float h_ranges[] = { 0, 180 };
        float s_ranges[] = { 0, 255 };
        float* ranges[] = { h_ranges, s_ranges };
        hist = cvCreateHist( 2, hist_size, CV_HIST_ARRAY, ranges, 1 );
    }

and here is my attempt 

 (setf hist (let* ((hist-size (cffi:foreign-alloc :int :initial-contents 
                              (list h-bins s-bins)))
               (h-ranges (cffi:foreign-alloc :float :initial-contents '(0.0 180.0)))
               (s-ranges (cffi:foreign-alloc :float :initial-contents '(0.0 255.0)))
               (ranges (cffi:foreign-alloc :initial-contents 
                           (list h-ranges s-ranges))))
           (create-hist 2 hist-size +hist-array+ ranges 1)))

cvCreateHist info is here 




Im getting this error in inferior lisp....i got it to move out of lisp but it gets stuck in c.  The rest of the program seems negligible so didnt post....this block i attempted to convert gets error...I tried only a few ways to write these array declarations because this is ALWAYS how i successfully do array declarations...I would be grateful for guidance and any extra info i can provide i will


OpenCV Error: Unknown error code -19 (Number of dimensions is out of range) in cvCreateHist,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20131024/0c6d1936/attachment.html>


More information about the cffi-devel mailing list