我想将图像加载到PictureBox
.这是我要加载的图片:http://www.gravatar.com/avatar/6810d91caff032b202c50701dd3af745?d = generalicon&r = PG
我该怎么做呢?
我正在使用Android应用程序.用户在谷歌地图上搜索餐馆.在谷歌地图显示所有邻居的餐厅标记.如果他点击标记,它会显示自定义InfoWindow.我的问题是我无法加载返回谷歌的图像.我正确的图像的网址,但我不能在窗口显示它.
信息窗口
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/bg_color" >
<ImageView
android:id="@+id/place_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"" />
<TextView
android:id="@+id/place_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/place_vicinity"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/bg_color" >
<RatingBar
android:id="@+id/place_rating"
style="?android:attr/ratingBarStyleSmall"
android:numStars="5"
android:rating="0"
android:isIndicator="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip" />
<ImageView
android:id="@+id/navigate_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:src="@drawable/navigate" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
在创造我有这个
mGoogleMap.setInfoWindowAdapter(new InfoWindowAdapter() {
// Use default InfoWindow frame
@Override
public View getInfoWindow(Marker arg0) {
return null;
}
// Defines the contents of the InfoWindow
@Override
public View …
Run Code Online (Sandbox Code Playgroud) 我想从背景中加载4个图像,显示加载条到客户端
,当下载图像时,我想将它们设置为4个div块的背景图像.
我正在寻找这样的东西.
var myImages = new Array();
for(var i = 0; i < 4; i++)
myImages[i] = new Image();
//load images using the src attribute
//and execute an on load event function where to do something like this.
var div0 = document.getElementById('theDivId');
div0.style.backgroundImage = myImage[index];
Run Code Online (Sandbox Code Playgroud)
有没有办法使用Image javascript对象设置背景图像?
我有一个活动,它有一个按钮.当我点击按钮时,它会将我重定向到图库.我想使用图像视图在下一个活动中显示所选图像.但它没有显示图像.设置图像时,视图不在屏幕上.
下面给出了我选择图像和下一步的代码.我在我的活动中没有使用历史真实.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK
&& null != data) {
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
if (!(picturePath.equals(""))) {
Intent intent = new Intent();
intent.setClass(MainActivity.this, ImageInGellary.class);
intent.putExtra("picturePath", picturePath);
startActivity(intent);
}
}
}
public class ImageInGellary extends Activity {
Button cancel; …
Run Code Online (Sandbox Code Playgroud) 我需要显示16x16像素图标以显示错误/警告/信息.不幸的是LoadIcon(0, IDI_*)
,LoadImage(0, OIC_*, IMAGE_ICON, 16, 16, LR_SHARED)
我总是给我32x32版本的图标.
我读过ShGetStockIconInfo
但是只能从Vista开始,我仍然需要支持XP.
有任何想法吗?
TImage
如果重要的话,我正在使用Delphi 2010和一个组件.
我想在 openCV 中使用 Mat 加载图像
我的代码是:
Mat I = imread("C:/images/apple.jpg", 0);
namedWindow( "Display window", CV_WINDOW_AUTOSIZE );// Create a window for display.
imshow( "Display window", I );
Run Code Online (Sandbox Code Playgroud)
我在消息框中收到以下错误:
Unhandled exception at 0x70270149 in matching.exe: 0xC0000005: Access violation
reading location 0xcccccccc.
Run Code Online (Sandbox Code Playgroud)
请注意,我包括:
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
#include <iostream>
#include <math.h>
Run Code Online (Sandbox Code Playgroud) 我正在编写一个函数,可以为我正在制作的游戏快速绘制菜单图像。我可以很好地绘制背景和文本块,但在屏幕上创建位图图像时遇到问题
bool menu::drawMenu(PAINTSTRUCT ps)
{
HWND hWnd = GetActiveWindow();
HDC hdc = GetDC(hWnd), hdcMem;
//Draw a new background
HPEN blackPen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
HBRUSH blackBrush = CreateSolidBrush(RGB(0, 0, 0));
SelectObject(hdc, blackPen);
SelectObject(hdc, blackBrush);
Rectangle(hdc, 0, 0, 1080, 720);
//insert selection text
TextOut(hdc, 30, 0, L"New Game", 8);
TextOut(hdc, 30, 30, L"Exit Game", 9);
//draw arrow sprite
HBITMAP arrow = (HBITMAP)LoadImage(NULL, L"C:\\Users\\Tim\documents\\visual studio 2013\\Projects\\BoulderBisque\\BoulderBisque\\arrow.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
DWORD lastError = GetLastError();
if (arrow == NULL)
{
TextOut(hdc, …
Run Code Online (Sandbox Code Playgroud) 我有一个程序将图像保存在本地目录中,然后从该目录中读取图像.
但我不想保存图像.我想直接从网址上阅读.
这是我的代码:
import cv2.cv as cv
import urllib2
url = "http://cache2.allpostersimages.com/p/LRG/18/1847/M5G8D00Z/posters/curious-cat.jpg"
filename = "my_test_image" + url[-4:]
print filename
opener = urllib2.build_opener()
page = opener.open(url)
img= page.read()
abc = open(filename, "wb")
abc.write(img)
abc.close()
img = cv.LoadImage(filename)
cv.ShowImage("Optical Flow", img)
cv.WaitKey(30)
Run Code Online (Sandbox Code Playgroud)
如果我改为:
img = cv.LoadImage(img)
Run Code Online (Sandbox Code Playgroud)
这会给我这个错误:
参数1必须是没有空字节的字符串,而不是str
我能做什么?
我是tensorflow的新手,但我已经遵循并执行了他们在网络上推广的教程和许多其他教程。我在MNIST图像上做了一个卷积神经网络。没什么特别的,但是我想对自己的图像进行测试。现在我的问题来了:我创建了几个文件夹;每个文件夹的名称是其中图像所属的类(标签)。
图像具有不同的形状;我的意思是他们没有固定的尺寸。
如何加载它们以用于Tensorflow?
我在StackOverflow和其他Q / A网站上都遵循了许多教程和答案。但是,我仍然不知道该怎么做。
我想考虑加载图像的所有可能情况.
我的项目允许用户根据一些图像回答一些问题.在ANDROID中,我在加载这些图像的某些场合遇到了问题.这会产生很大的负面影响,因为用户不知道该回答什么.
示例代码:
<Image
style={styles.imageBackground}
source={{ uri: obj.question }}/>
Run Code Online (Sandbox Code Playgroud)
经过多次测试,它似乎因某些奇怪的原因而失败.我 在这里看到了一些关于此的话题
无论如何(上面提到的或仅仅是在加载互联网连接的过程中失败),我希望能够重新加载图像.
在我看来,使用onError
事件并在那里放置一些东西,这将允许我第二次设置源
<Image
ref={'image' + key}
style={styles.imageBackground}
source={{ uri: obj.question }}
onError={(e) => {
this.refs['image' + key].setNativeProps({ src: [{ uri: obj.question }] })
}} />
Run Code Online (Sandbox Code Playgroud)
里面的线onError
对我不起作用.即使它有效,也应该考虑一些方面.例如,它可能导致无限循环,您必须有一个变量来控制该行在该onError
行中的次数.
我想问一下这个想法是否有意义,或者他们是否还有其他更好的想法.
PDTA:
1)设置a defaultSource
不是一个选项,因为它会严重影响ux.
2)所有图像应该没有问题地加载,因为它们先前存储在具有固定路径的服务器中.这使得图像无法加载.我能想到的唯一两种形状是我上面提到的形状
loadimage ×10
android ×3
image ×3
c++ ×2
opencv ×2
.net ×1
bitmap ×1
c# ×1
delphi ×1
directory ×1
google-maps ×1
infowindow ×1
javascript ×1
mat ×1
null ×1
picturebox ×1
python ×1
react-native ×1
tensorflow ×1
timage ×1
urllib2 ×1
winapi ×1