Environments:
OS: Ubuntu 20.04 LTS
OpenCV version: 4.4.0
OpenCL version: OpenCL 3.0 NEO
Device name: Intel(R) Iris(R) Xe Graphics
I test the following code with cv::UMat:
#include <opencv2/opencv.hpp>
int main()
{
std::string img_f = "...";
cv::UMat gray = cv::imread(img_f, 0).getUMat(cv::ACCESS_READ);
cv::UMat thresh;
cv::adaptiveThreshold(gray, thresh, 255, cv::ADAPTIVE_THRESH_MEAN_C,
cv::THRESH_BINARY, 21, 0);
cv::UMat opening;
cv::Mat kernel = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));
cv::morphologyEx(thresh, opening, cv::MORPH_OPEN, kernel);
cv::imwrite("res.png", opening);
}
But some errors occurred at run time:
OpenCL program build log: imgproc/morph3x3
Status -6: CL_OUT_OF_HOST_MEMORY
-D PROCESS_ELEM_=PROCESS(0,0)PROCESS(0,1)PROCESS(0,2)PROCESS(1,0)PROCESS(1,1)PROCESS(1,2)PROCESS(2,0)PROCESS(2,1)PROCESS(2,2) -D OP_ERODE -D INTEL_DEVICE
OpenCL program build log: imgproc/filterSmall
Status -6: CL_OUT_OF_HOST_MEMORY
-D cn=1 -D ANCHOR_X=1 -D ANCHOR_Y=1 -D KERNEL_SIZE_X=3 -D KERNEL_SIZE_Y=3 -D PX_LOAD_VEC_SIZE=4 -D PX_LOAD_NUM_PX=4 -D DEPTH_0 -D PX_PER_WI_X=8 -D PX_PER_WI_Y=2 -D PRIV_DATA_WIDTH=12 -D BORDER_CONSTANT -D NO_BORDER_ISOLATED -D PX_LOAD_X_ITERATIONS=3 -D PX_LOAD_Y_ITERATIONS=4 -D srcT=uchar -D srcT1=uchar -D dstT=srcT -D dstT1=srcT1 -D WT=srcT -D WT1=srcT1 -D convertToWT=noconvert -D convertToDstT=noconvert -D PX_LOAD_FLOAT_VEC_CONV=convert_uchar4 -D PROCESS_ELEM_=PROCESS(0,0)PROCESS(0,1)PROCESS(0,2)PROCESS(1,0)PROCESS(1,1)PROCESS(1,2)PROCESS(2,0)PROCESS(2,1)PROCESS(2,2) -D OP_ERODE -D INTEL_DEVICE
OpenCL program build log: imgproc/morph
Status -6: CL_OUT_OF_HOST_MEMORY
-D RADIUSX=1 -D RADIUSY=1 -D LSIZE0=16 -D LSIZE1=16 -D OP_ERODE -D PROCESS_ELEMS=PROCESS(0,0)PROCESS(0,1)PROCESS(0,2)PROCESS(1,0)PROCESS(1,1)PROCESS(1,2)PROCESS(2,0)PROCESS(2,1)PROCESS(2,2) -D T=uchar -D DEPTH_0 -D cn=1 -D T1=uchar -D convertToWT=convert_float -D convertToT=convert_uchar_sat_rte -D ST=uchar -D INTEL_DEVICE
If I change the kernel size of cv::morphologyEx bigger, i.e.
cv::Mat kernel = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(11, 11));
It can work.
Why does cv::morphologyEx with UMat have such limitation?
Related
Although the container should have the needed privileges to connect to the display, I got this error each time:
docker exec -it my_container
/# rqt
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
No protocol specified
QXcbConnection: Could not connect to display :1
Could not connect to any X display.
The following command has been used to run the container:
sudo docker run -itd --restart unless-stopped --name my_container --privileged --net=host --gpus all \
--env="NVIDIA_DRIVER_CAPABILITIES=all" \
--env="DISPLAY=$DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
my_image:v1.1
The solution is to run the following command in your terminal:
xhost +local:docker
Then try again, it should work:
docker exec -it my_container
/# rqt
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
envs:
host:centos
docker:ubuntu 16 nivida-docker
program:c++ websocket
desc:
when I use gdb in docker ,I can't use breakpoint ,it just says:warning: error disabling address space randomization: operation not permitted.I see alot of resolutions to this question,all of them tell me to add :--cap-add=SYS_PTRACE --security-opt seccomp=unconfinedto my docker file ,so I did it.here is my docker file:
!/bin/sh
SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
PROJECT_ROOT="$( cd "${SCRIPT_DIR}/.." && pwd )"
echo "PROJECT_ROOT = ${PROJECT_ROOT}"
run_type=$1
docker_name=$2
sudo docker run \
--name=${docker_name} \
--privileged \
--network host \
-it --rm \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
-v ${PROJECT_ROOT}/..:/home \
-v /ssd3:/ssd3 \
xxxx/xx/xxxx:xxxx \
bash
but when restart the container and run gdb ,it always killed like below:
(gdb) r -c conf/a.json -p 8075
Starting program: /home/Service/bin/Service --args -c conf/a.json -p 8075
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Killed
I don't known where is wrong ,anyone have any opinions?
Try this
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
I am using below command to monitor a single container. How can I extend this so that I can save the the tcp dump for later analysis using WireShark.
docker run -it --rm --net container:<container_name> \
nicolaka/netshoot tcpdump ...
tcpdump has an option to send raw captured packets to stdout, send it to a file on host:
docker run -it --rm --net container:<> nickolaka/netchoot tcpdump -w - > packets.dump
or wireshark directly
docker run -it --rm --net container:<> nickolaka/netchoot -i any -w - | wireshark -k -i -
I want to run multi line docker run command on windows.
say,
docker run --name packer \
-d ekambaram/packer:1.4.0
getting the below error
C:\Users\ekambaram_pasham>docker run --name packer \
docker: invalid reference format.
See 'docker run --help'.
C:\Users\ekambaram_pasham>-d ekambaram/packer:1.4.0
'-d' is not recognized as an internal or external command,
operable program or batch file.
In the command prompt on windows I was able to run multi line docker run commands as shown below
docker run --name packer ^
-d ekambaram/packer:1.4.0
use ^ as command separator instead of \
C:\Users\ekambaram_pasham>docker run --name packer ^
More? -d ekambaram/packer:1.4.0
7e3599a599a7b19613f50323456d66a324c2ac558bb71eb9060bda54dfcd8f4d
For PowerShell, you will need to substitute with ` (back tick) instead of ^ or \ as below
docker run -p 80:80 -p 443:443 `
-h hostname.domain `
-e "MYSQL_ROOT_PASSWORD=password" `
-e "SOGO_WORKERS=1" `
-e "POSTMASTER_PASSWORD=(plain)password" `
-e "IREDAPD_PLUGINS=['reject_null_sender', 'reject_sender_login_mismatch', 'greylisting', 'throttle', 'amavisd_wblist', 'sql_alias_access_policy']" `
-v iredmail_mysql:/var/lib/mysql `
-v iredmail_vmail:/var/vmail `
-v iredmail_clamav:/var/lib/clamav `
--name=iredmail lejmr/iredmail:mysql-latest
I am following this tutorial for service discovery http://jasonwilder.com/blog/2014/07/15/docker-service-discovery
Briefly:
I created an etcd host running at x.y.z.d:4001
docker run -d --name etcd -p 4001:4001 -p 7001:7001 coreos/etcd
Created a backend server running a container at backend_serverip:8000 and docker-register
$ docker run -d -p 8000:8000 --name whoami -t jwilder/whoami
$ docker run --name docker-register -d -e HOST_IP=$(hostname --all-ip-addresses | awk '{print $1}') -e ETCD_HOST=x.y.z.d:4001 -v /var/run/docker.sock:/var/run/docker.sock -t jwilder/docker-register
Created another backend server running a container at backend2_serverip:8000 and docker-register
$ docker run -d -p 8000:8000 --name whoami -t jwilder/whoami
$ docker run --name docker-register -d -e HOST_IP=$(hostname --all-ip-addresses | awk '{print $1}') -e ETCD_HOST=x.y.z.d:4001 -v /var/run/docker.sock:/var/run/docker.sock -t jwilder/docker-register
Created a client running docker-discover and an ubuntu image
$ docker run -d --net host --name docker-discover -e ETCD_HOST=10.170.71.226:4001 -p 127.0.0.1:1936:1936 -t jwilder/docker-discover
When I look at the logs to see if containers are being registered I see teh folowing error
2015/07/09 19:28:00 error running notify command: python /tmp/register.py, exit status 1
2015/07/09 19:28:00 Traceback (most recent call last):
File "/tmp/register.py", line 22, in <module>
backends = client.read("/backends")
File "/usr/local/lib/python2.7/dist-packages/etcd/client.py", line 347, in read
self.key_endpoint + key, self._MGET, params=params, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/etcd/client.py", line 587, in api_execute
return self._handle_server_response(response)
File "/usr/local/lib/python2.7/dist-packages/etcd/client.py", line 603, in _handle_ser
etcd.EtcdError.handle(**r)
File "/usr/local/lib/python2.7/dist-packages/etcd/__init__.py", line 184, in handle
raise exc(msg, payload)
etcd.EtcdKeyNotFound: Key not found : /backends
I tried manually creating this directory , I also tried running the containers with privileged option but no luck
The error you are getting is from a bug in the code. The problem is that /backends does not exist in your etcd directory. You can create it yourself by manually by running this:
curl -L http://127.0.0.1:4001/v2/keys/backends -XPUT -d dir=true
Once the directory exists in etcd, you won't get the error anymore.
I created a pull request that fixes the bug and if you want to use the fixed code, you can build your own image:
git clone git#github.com:rca/docker-register.git
cd docker-register
docker build -t docker-register .
Then your command for docker register would look like:
$ docker run --name docker-register -d -e HOST_IP=$(hostname --all-ip-addresses | awk '{print $1}') -e ETCD_HOST=x.y.z.d:4001 -v /var/run/docker.sock:/var/run/docker.sock -t docker-register
Note I simply removed jwilder/ from the image name in the command so it uses your local version.