本文整理汇总了C++中ImageLoader类的典型用法代码示例。如果您正苦于以下问题:C++ ImageLoader类的具体用法?C++ ImageLoader怎么用?C++ ImageLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImageLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qMin
void ImageListModel::fetchMore(const QModelIndex &)
{
int remainder = m_imageInfoList.count() - m_imageInfoCount;
int itemsToFetch = qMin(100, remainder);
int beginIndex = m_imageInfoCount;
int endIndex = beginIndex + itemsToFetch;
if (endIndex >= m_imageInfoList.count())
endIndex = m_imageInfoList.count() - 1;
beginInsertRows(QModelIndex(), beginIndex, endIndex);
m_imageInfoCount += itemsToFetch;
endInsertRows();
// start multithreaded image loading
for (int i = beginIndex; i <= endIndex; i++) {
const ImageInfo imageInfo = m_imageInfoList.at(i);
if (imageInfo.exists()) {
ImageLoader *imageLoader = new ImageLoader(imageInfo.imagePath(), i);
imageLoader->setScaleSize(MainWindow::MAX_THUMBNAIL_SIZE, MainWindow::MAX_THUMBNAIL_SIZE);
connect(imageLoader, SIGNAL(imageLoaded(QImage, int, int, int)), SLOT(thumbnailLoaded(QImage, int, int, int)));
m_imageLoaderPool.start(imageLoader);
}
}
emit changed();
qDebug("ImageListModel::fetchMore(): from %d to %d", beginIndex, endIndex);
}
示例2: Q_UNUSED
void WeatherItemFactory::updateItem(ListView* list, bb::cascades::VisualNode *listItem,
const QString &type, const QVariantList &indexPath, const QVariant &data)
{
Q_UNUSED(list);
Q_UNUSED(indexPath);
Q_UNUSED(type);
// Update the control with the correct data.
QVariantMap map = data.value<QVariantMap>();
WeatherItem *weatherItem = static_cast<WeatherItem *>(listItem);
ImageLoader *imloader = new ImageLoader();
imloader->loadImage(map["weatherIconUrl"].toString(), weatherItem->getConditionsImage(), "/wsymbols01_png_64/", ".png");
//set labels
weatherItem->setTime(map["time"].toString());
weatherItem->setWindSpeed(map["windspeedKmph"].toString());
weatherItem->setTemperature(map["tempC"]);
weatherItem->setCloudCover(map["cloudcover"].toString());
weatherItem->setPressure(map["pressure"].toString());
weatherItem->setHumidity(map["humidity"].toString());
weatherItem->setSwellHeight(map["swellHeight_m"].toString());
//rotate arrows
weatherItem->setWindDirection(180 + map["winddirDegree"].toFloat());
weatherItem->setSwellDirection(180 + map["swellDir"].toFloat());
}
示例3: GenUVSphere
void MainScreen::onInit(ScreenContext& sc)
{
// Store engine ref
mEngine = sc.GetEngine();
// Store file data cache ref
mFileDataCache = sc.GetFileDataCache();
// Cube rotation state
mRotationData.degreesInc = 0.05f;
mRotationData.rotating = false;
// Camera initial position
mCamera.SetPos(glm::vec3(0, 0, 8));
// Add sample UV Sphere
ModelData sphereModel = GenUVSphere(1, 32, 32);
mEngine->GetModelStore().Load("4", std::move(sphereModel));
// Create world objects
SetupWorld();
// Create world lights
SetupLights();
// Cam shouldn't follow character initially
mFollowingCharacter = false;
// Initial choosen moving light
mMovingLightIndex = 0;
// Init character
mCharacter.Init(&mEngine->GetWindow(), mScene.get());
// Load the skybox
ImageLoader imLoader;
auto& cubemapStore = mEngine->GetCubemapStore();
cubemapStore.Load(skybox, imLoader.Load(*(*mFileDataCache)["ext/Assets/Textures/Skybox/Bluesky/bluesky.tga"], "tga"));
mEngine->GetSkyboxRenderer().SetCubemapId(cubemapStore[skybox]->id);
// Load the irr map
mEngine->GetCubemapStore().Load(irrmap, imLoader.Load(*(*mFileDataCache)["ext/Assets/Textures/Skybox/Bluesky/bluesky_irr.tga"], "tga"));
// Load the rad map
for (unsigned int i = 0; i < 9; ++i) {
mEngine->GetCubemapStore().Load(
radmap,
imLoader.Load(*(*mFileDataCache)[
"ext/Assets/Textures/Skybox/Bluesky/bluesky_rad_" + std::to_string(i) + ".tga"], "tga"), i);
}
// Do not show AABBs by default
mShowAABBs = false;
// Do not show Debug info by default
mShowDbgInfo = false;
// Init renderform creator
mRenderformCreator = std::make_unique<RenderformCreator>(&(mEngine->GetModelStore()), &(mEngine->GetMaterialStore()));
}
示例4: libImage
unsigned int ImageLoader::recursiveUpdateDepth(unsigned int maxDepth)
{
// the purpose of this phase is to make the images sortable such that
// in a sort list of images, every image that an image depends on
// occurs in the list before it.
if ( fDepth == 0 ) {
// break cycles
fDepth = maxDepth;
// get depth of dependents
unsigned int minDependentDepth = maxDepth;
for(unsigned int i=0; i < libraryCount(); ++i) {
ImageLoader* dependentImage = libImage(i);
if ( (dependentImage != NULL) && !libIsUpward(i) ) {
unsigned int d = dependentImage->recursiveUpdateDepth(maxDepth);
if ( d < minDependentDepth )
minDependentDepth = d;
}
}
// make me less deep then all my dependents
fDepth = minDependentDepth - 1;
}
return fDepth;
}
示例5: memcpy
unsigned int __stdcall Texture::Atlas::ThreadLoadTexture( void* data ) {
Thread::Work *work = ( Thread::Work* ) data;
ThreadDataLoadTexture *loader = ( ThreadDataLoadTexture* ) work->data;
//__log.PrintInfo( Filelevel_DEBUG, "Texture::Atlas::ThreadLoadTexture => begin: data[%d] size[%d; %d]", loader->data->getLength(), loader->size.width, loader->size.height );
//
ImageLoader image;
if( !image.LoadFromBuffer( ( Byte* ) loader->data->getData(), loader->data->getLength() ) ) {
__log.PrintInfo( Filelevel_ERROR, "Texture::Atlas::ThreadLoadTexture => image.LoadFromBuffer failed" );
work->status = Thread::THREAD_WORK_STATUS_ERROR;
return 1;
}
Dword
*dst = ( Dword* ) loader->atlas->textureData.getData(),
*src = ( Dword* ) image.GetImageData();
for( Dword y = 0; y < image.GetImageSize().height; ++y ) {
memcpy( dst + ( loader->item->rect.top + y ) * loader->atlas->size.width + loader->item->rect.left, src + y * image.GetImageSize().width, image.GetImageSize().width * 4 );
}
loader->atlas->FlushToGPU();
//done
delete loader->data;
delete loader;
work->status = Thread::THREAD_WORK_STATUS_DONE;
//__log.PrintInfo( Filelevel_DEBUG, "Texture::Atlas::ThreadLoadTexture => done" );
return 0;
}//ThreadLoadTexture
示例6: ImageLoader
void PipelineManager::setup(QStringList fx, QDir &input, QDir &output)
{
// Chargement des images comme première étape du pipeline
ImageLoader *loader = new ImageLoader(this);
loader->setName("loader");
loader->setImageDir(input);
stageList.append(loader);
// Préparation des effets
foreach (QString fxName, fx) {
if (!effects.hasEffect(fxName)) {
qDebug() << "unkown effect " << fxName;
continue;
}
EffectStage *fxStage = new EffectStage(this);
fxStage->setName(fxName);
fxStage->setEffect(effects.effect(fxName));
stageList.append(fxStage);
}
// Sauvegarde des images comme dernière étape du pipeline
ImageSaver *saver = new ImageSaver(this);
saver->setName("saver");
saver->setOutput(output);
stageList.append(saver);
}
示例7: test_video
void test_video() {
VideoCapture cap(CV_CAP_ANY);
ImageProcessor processor;
ImageLoader loader;
NeuralNetwork net;
net.load(NET_FILE_NAME);
//net.visualize_hidden_units(1, 50);
if (!cap.isOpened()) {
cout << "Failed to initialize camera\n";
return;
}
namedWindow("CameraCapture");
namedWindow("ProcessedCapture");
cv::Mat frame;
while (true) {
cap >> frame;
cv::Mat processedFrame = processor.process_image(frame);
if(processedFrame.rows * processedFrame.cols == INPUT_LAYER_SIZE) {
mat input = loader.to_arma_mat(processedFrame);
int label = net.predict(input);
if(label == 0)
putText(frame, "A", Point(500, 300), FONT_HERSHEY_SCRIPT_SIMPLEX, 2, Scalar::all(0), 3, 8);
else if(label == 1)
putText(frame, "E", Point(500, 300), FONT_HERSHEY_SCRIPT_SIMPLEX, 2, Scalar::all(0), 3, 8);
else if(label == 2)
putText(frame, "I", Point(500, 300), FONT_HERSHEY_SCRIPT_SIMPLEX, 2, Scalar::all(0), 3, 8);
else if(label == 3)
putText(frame, "O", Point(500, 300), FONT_HERSHEY_SCRIPT_SIMPLEX, 2, Scalar::all(0), 3, 8);
else if(label == 4)
putText(frame, "U", Point(500, 300), FONT_HERSHEY_SCRIPT_SIMPLEX, 2, Scalar::all(0), 3, 8);
}
imshow("CameraCapture", frame);
imshow("ProcessedCapture", processedFrame);
int key = waitKey(5);
if(key == 13) {
imwrite("captura.jpg", frame);
}
if (key == 27)
break;
}
destroyAllWindows();
}
示例8: main
int main()
{
ImageLoader loader;
auto f = loader.LoadImage("../Resource/Fig0310(a)(Moon Phobos).jpg");
auto low_high(HW::strechlim(f));
//auto hist(HW::imhist(f,255));
auto g = HW::imadjust(f, low_high, 0,1);
ImageWriter writer;
writer.WritePNGImage(g, "imadjustTest.png");
return 0;
}
示例9: SetCursor
/*
=============
SetCursor
=============
*/
void Mouse::SetCursor( const std::string &imageFileName )
{
this->cursor.isHardware = true;
ImageLoader image;
image.LoadFromFile( imageFileName );
this->cursor.size.Set( float( image.GetImageSize()->width ) , float( image.GetImageSize()->height ) );
this->cursor.spriteOffset.Set( this->cursor.size.x * 0.5f * this->cursor.pixelsToTexels.x, this->cursor.size.y * 0.5f * this->cursor.pixelsToTexels.y, 0.0f );
ShowCursor( false );
}//SetCursor
示例10: skinPath
Assets::Texture* Md2Parser::loadTexture(const Md2Skin& skin) {
const Path skinPath(String(skin.name));
MappedFile::Ptr file = m_fs.openFile(skinPath);
Color avgColor;
const ImageLoader image(ImageLoader::PCX, file->begin(), file->end());
const Buffer<unsigned char>& indices = image.indices();
Buffer<unsigned char> rgbImage(indices.size() * 3);
m_palette.indexedToRgb(indices, indices.size(), rgbImage, avgColor);
return new Assets::Texture(skin.name, image.width(), image.height(), avgColor, rgbImage);
}
示例11: mess
void
Image::load( const std::string &filename )
{
using namespace std;
size_t pos = filename.find_last_of('.');
if ( pos == string::npos ) {
std::string mess("Image::load: Can't load image ");
mess.append(filename);
throw new Exception(mess);
}
const string ext = filename.substr(pos+1);
ImageLoader *imgLoader = ImageLoader::getImageLoader(ext);
imgData = imgLoader->load(filename);
}
示例12: WXUNUSED
void ClientStateIndicator::RunConnectionAnimation(wxTimerEvent& WXUNUSED(event)){
if(indexIndVis < numOfIndic){
indexIndVis++;
for(int j = 0; j < indexIndVis; j++){
ImageLoader *currInd = m_connIndV[j];
currInd->Show(true);
}
}else{
indexIndVis = 0;
for(int i = 0; i < numOfIndic; i++){
ImageLoader *currInd = m_connIndV[i];
currInd->Show(false);
}
}
}
示例13: atoi
EntityArchetype::EntityArchetype(xmlpp::Document* doc, ImageLoader& loader, Database* db) {
const xmlpp::Element* root = dynamic_cast<const xmlpp::Element*>(doc->get_root_node());
name = dynamic_cast<const xmlpp::Element*>(root->find("name")[0])->get_child_text()->get_content();
width = atoi(dynamic_cast<const xmlpp::Element*>(root->find("width")[0])->get_child_text()->get_content().c_str());
height = atoi(dynamic_cast<const xmlpp::Element*>(root->find("height")[0])->get_child_text()->get_content().c_str());
frames = atoi(dynamic_cast<const xmlpp::Element*>(root->find("frames")[0])->get_child_text()->get_content().c_str());
std::string imgName = dynamic_cast<const xmlpp::Element*>(root->find("image")[0])->get_child_text()->get_content();
if (!root->find("scripts").empty()) {
const xmlpp::Element* scripts = dynamic_cast<const xmlpp::Element*>(root->find("scripts")[0]);
if (!scripts->find("idle").empty())
idleScript = dynamic_cast<const xmlpp::Element*>(scripts->find("idle")[0])->get_child_text()->get_content();
if (!scripts->find("timer").empty())
timerScript = dynamic_cast<const xmlpp::Element*>(scripts->find("timer")[0])->get_child_text()->get_content();
if (!scripts->find("init").empty())
initScript = dynamic_cast<const xmlpp::Element*>(scripts->find("init")[0])->get_child_text()->get_content();
}
std::vector<xmlpp::Node*> modeNodes = root->find("modes");
for (unsigned int i = 0; i < modeNodes.size(); ++i) {
modes.push_back(dynamic_cast<const xmlpp::Element*>(modeNodes[i])->get_child_text()->get_content());
}
image = loader.loadFromFile("gfx/entities/" + imgName);
}
示例14:
Sampler2D::Sampler2D(const std::string &filename, u32 s){
settings = s;
ImageLoader loader;
ImageData image = loader.loadTrueRaw(filename);
width = image.width;
height = image.height;
info("SAMPLER", "from:", filename, width, ":", height);
switch(image.originalFormat){
case gl::RED :
data = make_unique<SamplerSingleChannelU8>(image.data, image.width, image.height);
break;
case gl::BGR : break;
case gl::BGRA : break;
};
}
示例15: setFormat
FrameDisplayGL ::FrameDisplayGL(QWidget *parent)
{
QGLFormat frmt;
setFormat(frmt);
currWidth =visibleRegion().boundingRect().width();
currHeight=visibleRegion().boundingRect().height();
QString msg = QString("Loading image into QImage");
Profiler timer(msg);
timer.start();
ImageLoader i;
QString x("/home/xmk/programming/capella/test/images/m51.jpg");
image = i.imageLoader( &x, 0 );
//i.loadImage("/home/xmk/programming/skeleton/test/images/m42.jpg", 1 );
timer.finish();
}