本文整理汇总了C++中ImageType::getHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageType::getHeight方法的具体用法?C++ ImageType::getHeight怎么用?C++ ImageType::getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageType
的用法示例。
在下文中一共展示了ImageType::getHeight方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: verifyImagePixels
void verifyImagePixels(const ImageType& image,
ImageFunction expectedPixels) {
auto width = image.getWidth();
auto height = image.getHeight();
verifyImagePixels(image, width, height, expectedPixels);
}
示例2: getLocalWorkSize
cl::NDRange getLocalWorkSize(const ImageType&,
const ImageType& destinationImage) const override {
auto width = destinationImage.getWidth();
auto height = destinationImage.getHeight();
return cl::NDRange(width / 2, height / 2);
}
示例3: newIntImage
static jobject newIntImage(JNIEnv* env, ImageType& image) {
jclass cls = safeFindClassMacro(cls, "Lcom/intel/vpg/IntImage;")
jmethodID clsCons = safeFindMethodMacro(clsCons, cls, "<init>", "(II)V")
jobject jintImage = env->NewObject(cls, clsCons, image.getWidth(),
image.getHeight());
jfieldID dataField = env->GetFieldID(cls, "data", "[I");
jintArray jdata = (jintArray) env->GetObjectField(jintImage, dataField);
arrayCopyToJNIMacro(data, Int, jint, image.getData())
return jintImage;
}
示例4: grid_size
// The evolve method filters the "current" image passed in by the INVT
// simulation framework and computes this image's gist vector. To compute
// this vector, it first applies Gabor filters to the input image at
// different orientations and scales. Then, it subdivides each of the
// filteration results into smaller "chunks" and populates the gist
// vector with the average pixel values in these coarse chunks.
void GistEstimatorContextBased::
onSimEventVisualCortexOutput(SimEventQueue& q, rutz::shared_ptr<SimEventVisualCortexOutput>& e)
{
///////////// VisualCortex* vc = dynamic_cast<VisualCortex*>(e->source()) ;
const double G = GRID_SIZE ;
const int N = GRID_SIZE * GRID_SIZE ;
Image<double>::iterator gist_vector = itsGistVector.beginw() ;
clock_t start_time = clock() ;
for (uint orientation = 0; orientation < NUM_ORIENTATIONS; ++orientation)
for (uint scale = 0; scale < NUM_SCALES; ++scale, gist_vector += N)
{
LFATAL("Please talk to Laurent to fix this");
ImageType I; /////// = apply_gabor_filter(vc, orientation, scale) ;
//LINFO("Gabor filter [O:%u, S:%u] returned %dx%d image",
//orientation, scale, I.getWidth(), I.getHeight()) ;
Dims grid_size(static_cast<int>(std::ceil(I.getWidth()/G)),
static_cast<int>(std::ceil(I.getHeight()/G))) ;
//LINFO("computing averages for %dx%d subimages of filtered image",
//grid_size.w(), grid_size.h()) ;
std::vector<double> averages = grid_averages(I, grid_size) ;
//LINFO("copying %d averages to gist vector at offset %d",
//int(averages.size()),
//int(gist_vector - itsGistVector.beginw())) ;
std::copy(averages.begin(), averages.end(), gist_vector) ;
}
LINFO("%g seconds to compute %dx%d gist vector",
static_cast<double>(clock() - start_time)/CLOCKS_PER_SEC,
itsGistVector.getHeight(), itsGistVector.getWidth()) ;
rutz::shared_ptr<SimEventGistOutput>
gist_event(new SimEventGistOutput(this, itsGistVector)) ;
q.post(gist_event) ;
}
示例5: draw
void GlutImage::draw()
{
if (m_firstRun)
{
glGenTextures(1, &m_texture);
m_firstRun = false;
}
glDisable(GL_LIGHTING);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBindTexture(GL_TEXTURE_2D, m_texture);
ImageType imageData;
if(image.tryTakeChanged(&imageData))
{
float maxPixel = imageData.getAsVector().maxCoeff();
if (maxPixel > 1.0)
{
float scaleFactor = 1.0 / maxPixel;
glPixelTransferf(GL_RED_SCALE, scaleFactor);
glPixelTransferf(GL_BLUE_SCALE, scaleFactor);
glPixelTransferf(GL_GREEN_SCALE, scaleFactor);
}
else
{
glPixelTransferf(GL_RED_SCALE, 1.0);
glPixelTransferf(GL_BLUE_SCALE, 1.0);
glPixelTransferf(GL_GREEN_SCALE, 1.0);
}
switch (imageData.getNumChannels())
{
case 1:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, static_cast<GLsizei>(imageData.getWidth()),
static_cast<GLsizei>(imageData.getHeight()), 0, GL_LUMINANCE, GL_FLOAT, imageData.getData());
break;
case 3:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, static_cast<GLsizei>(imageData.getWidth()),
static_cast<GLsizei>(imageData.getHeight()), 0, GL_RGB, GL_FLOAT, imageData.getData());
break;
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
glColor3d(1, 1, 1);
glBegin(GL_QUADS);
glTexCoord2f(1, 1);
glVertex2f(m_bounds.min()(0), m_bounds.min()(1));
glTexCoord2f(0, 1);
glVertex2f(m_bounds.max()(0), m_bounds.min()(1));
glTexCoord2f(0, 0);
glVertex2f(m_bounds.max()(0), m_bounds.max()(1));
glTexCoord2f(1, 0);
glVertex2f(m_bounds.min()(0), m_bounds.max()(1));
glEnd();
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
}
示例6: draw
virtual void draw()
{
if (m_firstRun)
{
glGenTextures(1, &m_texture);
m_firstRun = false;
}
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(-m_numImages, m_numImages, -1, 1, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBindTexture(GL_TEXTURE_2D, m_texture);
ImageType imageData;
if(image.tryTakeChanged(&imageData))
{
float maxPixel = imageData.getAsVector().maxCoeff();
if (maxPixel > 1.0)
{
float scaleFactor = 1.0 / maxPixel;
glPixelTransferf(GL_RED_SCALE, scaleFactor);
glPixelTransferf(GL_BLUE_SCALE, scaleFactor);
glPixelTransferf(GL_GREEN_SCALE, scaleFactor);
}
else
{
glPixelTransferf(GL_RED_SCALE, 1.0);
glPixelTransferf(GL_BLUE_SCALE, 1.0);
glPixelTransferf(GL_GREEN_SCALE, 1.0);
}
switch (imageData.getNumChannels())
{
case 1:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, imageData.getWidth(), imageData.getHeight(), 0, GL_LUMINANCE,
GL_FLOAT, imageData.getData());
break;
case 3:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, imageData.getWidth(), imageData.getHeight(), 0, GL_RGB, GL_FLOAT,
imageData.getData());
break;
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
int xMin = -m_numImages + m_imageNum * 2;
glColor4f(1,1,1,1);
glBegin(GL_QUADS);
glTexCoord2f(1, 1);
glVertex2f(xMin, -1.0);
glTexCoord2f(0, 1);
glVertex2f(xMin+2, -1.0);
glTexCoord2f(0, 0);
glVertex2f(xMin+2, 1.0);
glTexCoord2f(1, 0);
glVertex2f(xMin, 1.0);
glEnd();
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
}