J
John1982_2
Guest
Hi Have a which is working on c++ i need to convert it into c# using, as i am not familiar with c++, i am having issue on passing rims, as i am as array on c# , what i need to change for c# to CX_RAM_Image** p_ims
EXTERN_C CXVFRSDK int CXAPI CX_AddImagesToPerson(CX_AUREUS p_aureus, int person_id, CX_RAM_Image** p_ims, int n_images, char* msg);
// a structure for passing in images via RAM
struct CX_RAM_Image
{
cx_byte* mp_pixels;
cx_uint m_rows;
cx_uint m_cols;
cx_uint m_type; // 0=RGB, 1=RGBA, 2=Gray, 3=BGR, 4=BGRA
cx_uint m_origin; // 0=top left, 1=bottom left
};
void CX_GalleryList(){
CX_RAM_Image** rims = (CX_RAM_Image**)malloc(images.size() * sizeof(CX_RAM_Image*));
for (k = 0; k < (cx_int)images.size(); k++)
{
CX_Image& im = images[k];
rims[k] = new CX_RAM_Image();
rims[k]->mp_pixels = im.mp_pixels;
rims[k]->m_rows = im.m_rows;
rims[k]->m_cols = im.m_cols;
rims[k]->m_origin = im.m_origin;
rims[k]->m_type = im.m_type;
}
// example of adding multiple images to an existing person
if (0 == CX_AddImagesToPerson(mp_mainframe->mp_aureus, p.m_person_id, rims, (cx_int)images.size(), msg))
// simple example showing how to add as a new person, obviously this
// is not what is intended (because we should be adding an image set to the selected
// person, using the function above) but it shows you that this (commented out) function
// can also be used in the same way
//if (-1 == CX_AddNewPersonMultiImage(mp_mainframe->mp_aureus, p_name.c_str(), rims, (cx_int)images.size(), msg))
{
wxMessageBox(msg);
}
}
Continue reading...
EXTERN_C CXVFRSDK int CXAPI CX_AddImagesToPerson(CX_AUREUS p_aureus, int person_id, CX_RAM_Image** p_ims, int n_images, char* msg);
// a structure for passing in images via RAM
struct CX_RAM_Image
{
cx_byte* mp_pixels;
cx_uint m_rows;
cx_uint m_cols;
cx_uint m_type; // 0=RGB, 1=RGBA, 2=Gray, 3=BGR, 4=BGRA
cx_uint m_origin; // 0=top left, 1=bottom left
};
void CX_GalleryList(){
CX_RAM_Image** rims = (CX_RAM_Image**)malloc(images.size() * sizeof(CX_RAM_Image*));
for (k = 0; k < (cx_int)images.size(); k++)
{
CX_Image& im = images[k];
rims[k] = new CX_RAM_Image();
rims[k]->mp_pixels = im.mp_pixels;
rims[k]->m_rows = im.m_rows;
rims[k]->m_cols = im.m_cols;
rims[k]->m_origin = im.m_origin;
rims[k]->m_type = im.m_type;
}
// example of adding multiple images to an existing person
if (0 == CX_AddImagesToPerson(mp_mainframe->mp_aureus, p.m_person_id, rims, (cx_int)images.size(), msg))
// simple example showing how to add as a new person, obviously this
// is not what is intended (because we should be adding an image set to the selected
// person, using the function above) but it shows you that this (commented out) function
// can also be used in the same way
//if (-1 == CX_AddNewPersonMultiImage(mp_mainframe->mp_aureus, p_name.c_str(), rims, (cx_int)images.size(), msg))
{
wxMessageBox(msg);
}
}
Continue reading...